aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2015-08-31 11:22:10 -0400
committerIlya Dryomov <idryomov@gmail.com>2015-09-08 16:14:30 -0400
commitd194cd1dd1be61249b08e5461ae8a9c05d1072c9 (patch)
tree781a4e1639f3ac1dcd40e6e05154ddc9846ef784
parent3ebe138ac642a195c7f2efdb918f464734421fd6 (diff)
rbd: plug rbd_dev->header.object_prefix memory leak
Need to free object_prefix when rbd_dev_v2_snap_context() fails, but only if this is the first time we are reading in the header. Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org>
-rw-r--r--drivers/block/rbd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 324bf35ec4dd..69d03aa46d0d 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -4720,7 +4720,10 @@ static int rbd_dev_v2_header_info(struct rbd_device *rbd_dev)
4720 } 4720 }
4721 4721
4722 ret = rbd_dev_v2_snap_context(rbd_dev); 4722 ret = rbd_dev_v2_snap_context(rbd_dev);
4723 dout("rbd_dev_v2_snap_context returned %d\n", ret); 4723 if (ret && first_time) {
4724 kfree(rbd_dev->header.object_prefix);
4725 rbd_dev->header.object_prefix = NULL;
4726 }
4724 4727
4725 return ret; 4728 return ret;
4726} 4729}