iscsi-support: fix memory leak

If doesn't support the report_supported_opcodes, the task will not be
freed in REPORT_SUPPORTED_OPCODES.

Change-Id: I1e251eec518721fb35e51013621aa61865d4b46b
Signed-off-by: Li Feng <fengli@smartx.com>
This commit is contained in:
Li Feng
2021-10-01 08:15:12 +08:00
committed by Bart Van Assche
parent d592e2e01e
commit 97d2f681d7
2 changed files with 6 additions and 5 deletions

View File

@@ -2130,7 +2130,7 @@ int report_supported_opcodes(struct scsi_device *sdev, struct scsi_task **out_ta
task = send_scsi_command(sdev, task, NULL);
ret = check_result("REPORT_SUPPORTED_OPCODES", sdev, task, status, key, ascq, num_ascq);
if (out_task) {
if (out_task && ret != -2 /* Not Supported */) {
*out_task = task;
} else if (task) {
scsi_free_scsi_task(task);