There is a memory leak in tcm_loop_make_scsi_hba(). If all the strstr() calls return NULL and we end up at return ERR_PTR(-EINVAL); then we'll be leaking the memory previously allocated to tl_hba as that variable goes out of scope. This patch should fix the leak. Signed-off-by: Jesper Juhl <jj@xxxxxxxxxxxxx> --- drivers/target/loopback/tcm_loop.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) Compile tested only. Last submitted April 07, 2011 diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 70c2e7f..aa3bb70 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -1321,7 +1321,8 @@ struct se_wwn *tcm_loop_make_scsi_hba( printk(KERN_ERR "Unable to locate prefix for emulated Target Port:" " %s\n", name); - return ERR_PTR(-EINVAL); + ret = -EINVAL; + goto out; check_len: if (strlen(name) >= TL_WWN_ADDR_LEN) { -- 1.7.5.2 -- Jesper Juhl <jj@xxxxxxxxxxxxx> http://www.chaosbits.net/ Don't top-post http://www.catb.org/jargon/html/T/top-post.html Plain text mails only, please. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html