aboutsummaryrefslogtreecommitdiff
path: root/block/rbd.c
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2014-12-04 14:34:11 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2014-12-12 13:16:56 +0000
commit9281dbe6535d79ecae121f6c3e620c25d55230e9 (patch)
tree4a8b959e81231dc3c99b14c99b15cb9637938878 /block/rbd.c
parent942764cc3286d9931ea58fce4e299813daeabfe4 (diff)
block/rbd: fix memory leak
Variable local_err going out of scope leaks the storage it points to. Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Amos Kong <akong@redhat.com> Message-id: 1417674851-6248-1-git-send-email-arei.gonglei@huawei.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/rbd.c')
-rw-r--r--block/rbd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/block/rbd.c b/block/rbd.c
index 5b5a64a27a..f3ab2ddd5a 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -459,7 +459,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
clientname = qemu_rbd_parse_clientname(conf, clientname_buf);
r = rados_create(&s->cluster, clientname);
if (r < 0) {
- error_setg(&local_err, "error initializing");
+ error_setg(errp, "error initializing");
goto failed_opts;
}
@@ -495,19 +495,19 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
r = rados_connect(s->cluster);
if (r < 0) {
- error_setg(&local_err, "error connecting");
+ error_setg(errp, "error connecting");
goto failed_shutdown;
}
r = rados_ioctx_create(s->cluster, pool, &s->io_ctx);
if (r < 0) {
- error_setg(&local_err, "error opening pool %s", pool);
+ error_setg(errp, "error opening pool %s", pool);
goto failed_shutdown;
}
r = rbd_open(s->io_ctx, s->name, &s->image, s->snap);
if (r < 0) {
- error_setg(&local_err, "error reading header from %s", s->name);
+ error_setg(errp, "error reading header from %s", s->name);
goto failed_open;
}