Thread (15 messages) 15 messages, 1 author, 2011-02-25
STALE5617d

[PATCH 01/14] target: Fix memory leak on error path in pscsi_alloc_task

From: Nicholas A. Bellinger <hidden>
Date: 2011-02-25 19:50:17
Subsystem: scsi target subsystem, the rest · Maintainers: "Martin K. Petersen", Linus Torvalds

From: Roland Dreier <redacted>

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 <redacted>
Signed-off-by: Nicholas A. Bellinger <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help