All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [SCSI] target: Fix memory leak on error path
@ 2011-01-16  5:42 Roland Dreier
  2011-01-16  7:09 ` Nicholas A. Bellinger
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Dreier @ 2011-01-16  5:42 UTC (permalink / raw)
  To: linux-kernel, Nicholas A. Bellinger

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>
---
 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 742d246..60a2509 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-16  7:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-16  5:42 [PATCH] [SCSI] target: Fix memory leak on error path Roland Dreier
2011-01-16  7:09 ` Nicholas A. Bellinger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.