T1030_unsolicited_data_overflow: remove unused variable

old_first_burst_len is set but never used - remove it. Also replace an
  if (!ptr)
    free(ptr)
with
  free(ptr)

as the check is redundant.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
This commit is contained in:
Arne Redlich
2012-10-31 16:48:48 +01:00
parent e0555555bb
commit 17e8b54759

View File

@@ -1,16 +1,16 @@
/* /*
Copyright (C) 2012 by Ronnie Sahlberg <ronniesahlberg@gmail.com> Copyright (C) 2012 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. along with this program; if not, see <http://www.gnu.org/licenses/>.
*/ */
@@ -40,14 +40,13 @@ static void test_cb(struct iscsi_context *iscsi _U_, int status,
} }
int T1030_unsolicited_data_overflow(const char *initiator, const char *url, int data_loss, int show_info) int T1030_unsolicited_data_overflow(const char *initiator, const char *url, int data_loss, int show_info)
{ {
struct iscsi_context *iscsi, *iscsi2; struct iscsi_context *iscsi, *iscsi2;
struct scsi_task *task; struct scsi_task *task;
struct scsi_readcapacity16 *rc16; struct scsi_readcapacity16 *rc16;
int ret, lun; int ret, lun;
unsigned char *buf = NULL; unsigned char *buf = NULL;
struct iscsi_async_state test_state; struct iscsi_async_state test_state;
uint32_t old_first_burst_len;
printf("1030_unsolicited_data_overflow:\n"); printf("1030_unsolicited_data_overflow:\n");
printf("===============================\n"); printf("===============================\n");
@@ -99,7 +98,7 @@ int T1030_unsolicited_data_overflow(const char *initiator, const char *url, int
ret = 0; ret = 0;
iscsi->use_immediate_data = ISCSI_IMMEDIATE_DATA_YES; iscsi->use_immediate_data = ISCSI_IMMEDIATE_DATA_YES;
old_first_burst_len = iscsi->first_burst_length;
/* make first burst REAL big */ /* make first burst REAL big */
iscsi->first_burst_length *= 16; iscsi->first_burst_length *= 16;
buf = malloc(iscsi->first_burst_length); buf = malloc(iscsi->first_burst_length);
@@ -141,9 +140,8 @@ test2:
printf("[OK]\n"); printf("[OK]\n");
finished: finished:
if (buf) {
free(buf); free(buf);
}
iscsi_destroy_context(iscsi); iscsi_destroy_context(iscsi);
iscsi_destroy_context(iscsi2); iscsi_destroy_context(iscsi2);
return ret; return ret;