From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Nicholas A. Bellinger" Subject: [PATCH 01/21] target: Fix memory leak on error path in pscsi_alloc_task Date: Mon, 14 Mar 2011 04:05:55 -0700 Message-ID: <1300100775-10012-2-git-send-email-nab@linux-iscsi.org> References: <1300100775-10012-1-git-send-email-nab@linux-iscsi.org> Return-path: In-Reply-To: <1300100775-10012-1-git-send-email-nab@linux-iscsi.org> Sender: linux-kernel-owner@vger.kernel.org To: linux-scsi , linux-kernel , James Bottomley Cc: Christoph Hellwig , Mike Christie , Hannes Reinecke , FUJITA Tomonori , Boaz Harrosh , Joel Becker , Stephen Rothwell , Douglas Gilbert , Roland Dreier , "Nicholas A. Bellinger" List-Id: linux-scsi@vger.kernel.org From: Roland Dreier 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 --- drivers/target/target_core_pscsi.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index f2a0847..f596cb7 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -817,6 +817,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 -- 1.7.4.1