diff mbox

[3/3,-next] tcm_vhost: call kfree() on an error path

Message ID 20120712144852.GF24202@elgon.mountain (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter July 12, 2012, 2:48 p.m. UTC
There is a memory leak here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Nicholas A. Bellinger July 12, 2012, 9:49 p.m. UTC | #1
On Thu, 2012-07-12 at 17:48 +0300, Dan Carpenter wrote:
> There is a memory leak here.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
> index 57d39c5..29850cb 100644
> --- a/drivers/vhost/tcm_vhost.c
> +++ b/drivers/vhost/tcm_vhost.c
> @@ -1420,6 +1420,7 @@ static struct se_wwn *tcm_vhost_make_tport(
>  
>  	pr_err("Unable to locate prefix for emulated Target Port:"
>  			" %s\n", name);
> +	kfree(tport);
>  	return ERR_PTR(-EINVAL);
>  
>  check_len:

Applied to for-next-merge, and folding the series into the initial merge
commit now..

Thank you!

--nab

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
index 57d39c5..29850cb 100644
--- a/drivers/vhost/tcm_vhost.c
+++ b/drivers/vhost/tcm_vhost.c
@@ -1420,6 +1420,7 @@  static struct se_wwn *tcm_vhost_make_tport(
 
 	pr_err("Unable to locate prefix for emulated Target Port:"
 			" %s\n", name);
+	kfree(tport);
 	return ERR_PTR(-EINVAL);
 
 check_len: