diff options
author | Markus Armbruster <armbru@redhat.com> | 2014-05-28 11:17:01 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-05-30 14:26:54 +0200 |
commit | 6376f9522372d589f3efe60001dc0486237dd375 (patch) | |
tree | 3074511ff3d7a2bb3fd1d08aed3b886030ddfb65 | |
parent | 543f7bef1353be4b30543aa1888048a7b6abb2e9 (diff) |
blockdev: Plug memory leak in blockdev_init()
blockdev_init() leaks bs_opts when qemu_opts_create() fails, i.e. when
the ID is bad. Missed in commit ec9c10d.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | blockdev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/blockdev.c b/blockdev.c index 8cc42fb1d0..652a0523b8 100644 --- a/blockdev.c +++ b/blockdev.c @@ -351,7 +351,7 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts, opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error); if (error) { error_propagate(errp, error); - return NULL; + goto err_no_opts; } qemu_opts_absorb_qdict(opts, bs_opts, &error); @@ -564,8 +564,9 @@ bdrv_new_err: g_free(dinfo->id); g_free(dinfo); early_err: - QDECREF(bs_opts); qemu_opts_del(opts); +err_no_opts: + QDECREF(bs_opts); return NULL; } |