diff mbox

rbd: do not leak image_id in rbd_dev_v2_parent_info()

Message ID 1404121556-4854-1-git-send-email-ilya.dryomov@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov June 30, 2014, 9:45 a.m. UTC
image_id is leaked if the parent happens to have been recorded already.
Fix it.

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
---
 drivers/block/rbd.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Alex Elder July 7, 2014, 10:40 p.m. UTC | #1
On 06/30/2014 04:45 AM, Ilya Dryomov wrote:
> image_id is leaked if the parent happens to have been recorded already.
> Fix it.

Looks good.

Reviewed-by: Alex Elder <elder@linaro.org>

> 
> Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
> ---
>  drivers/block/rbd.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index d99aa81774f8..adedb393b374 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -4072,6 +4072,8 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
>  		parent_spec->snap_id = snap_id;
>  		rbd_dev->parent_spec = parent_spec;
>  		parent_spec = NULL;	/* rbd_dev now owns this */
> +	} else {
> +		kfree(image_id);
>  	}
>  
>  	/*
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" 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/block/rbd.c b/drivers/block/rbd.c
index d99aa81774f8..adedb393b374 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4072,6 +4072,8 @@  static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
 		parent_spec->snap_id = snap_id;
 		rbd_dev->parent_spec = parent_spec;
 		parent_spec = NULL;	/* rbd_dev now owns this */
+	} else {
+		kfree(image_id);
 	}
 
 	/*