change dont automatically free the scsi_task once the callback completes.

Freeing the scsi_task structure is the responsibility of the application
to either do so during the callback, or later.
This commit is contained in:
Ronnie Sahlberg
2011-03-27 17:53:05 +11:00
parent 4e6e39ee23
commit f4f6ef5033
7 changed files with 51 additions and 21 deletions

View File

@@ -60,10 +60,12 @@ void write10_cb(struct iscsi_context *iscsi, int status, void *command_data, voi
if (status == SCSI_STATUS_CHECK_CONDITION) {
printf("Write10 failed with sense key:%d ascq:%04x\n", task->sense.key, task->sense.ascq);
scsi_free_scsi_task(task);
exit(10);
}
if (status != SCSI_STATUS_GOOD) {
printf("Write10 failed with %s\n", iscsi_get_error(iscsi));
scsi_free_scsi_task(task);
exit(10);
}
@@ -74,6 +76,7 @@ void write10_cb(struct iscsi_context *iscsi, int status, void *command_data, voi
client->finished = 1;
}
scsi_free_scsi_task(wt->rt);
scsi_free_scsi_task(task);
free(wt);
}
@@ -89,7 +92,6 @@ void read10_cb(struct iscsi_context *iscsi, int status, void *command_data, void
}
wt = malloc(sizeof(struct write_task));
iscsi_cbdata_steal_scsi_task(task);
wt->rt = task;
wt->client = client;
@@ -102,6 +104,7 @@ void read10_cb(struct iscsi_context *iscsi, int status, void *command_data, void
client->dst_blocksize, write10_cb,
wt) != 0) {
printf("failed to send read10 command\n");
scsi_free_scsi_task(task);
exit(10);
}
}