Quellcode durchsuchen

[SCSI] target: Fix memory leak on error path in pscsi_alloc_task

If allocation of pt->pscsi_cdb fails, we need to free the just-allocated
pt or else it will be leaked.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Roland Dreier vor 14 Jahren
Ursprung
Commit
8fc1858a42
1 geänderte Dateien mit 1 neuen und 0 gelöschten Zeilen
  1. 1 0
      drivers/target/target_core_pscsi.c

+ 1 - 0
drivers/target/target_core_pscsi.c

@@ -816,6 +816,7 @@ pscsi_alloc_task(struct se_cmd *cmd)
 		if (!(pt->pscsi_cdb)) {
 			printk(KERN_ERR "pSCSI: Unable to allocate extended"
 					" pt->pscsi_cdb\n");
+			kfree(pt);
 			return NULL;
 		}
 	} else