From: Roland Dreier Date: Mon, 14 Mar 2011 11:05:55 +0000 (-0700) Subject: [SCSI] target: Fix memory leak on error path in pscsi_alloc_task X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8fc1858a42663248d5b362edc313786e0be7a639;p=linux-beck.git [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 Signed-off-by: Nicholas A. Bellinger Signed-off-by: James Bottomley --- diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 5a9d2ba4b609..3031ef8261ef 100644 --- a/drivers/target/target_core_pscsi.c +++ b/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