diff options
author | Markus Armbruster <armbru@redhat.com> | 2014-05-28 11:17:01 +0200 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2014-07-03 16:31:29 -0500 |
commit | d2b987479a322f246753ce82a5b6f535e15626f4 (patch) | |
tree | e9cc39258a4a710ce9ea4e3a92ab2d36cd421952 | |
parent | c2fb0f287011b23183739e183ab4b0668476cc4b (diff) | |
download | qemu-d2b987479a322f246753ce82a5b6f535e15626f4.tar.gz |
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>
(cherry picked from commit 6376f9522372d589f3efe60001dc0486237dd375)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r-- | blockdev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/blockdev.c b/blockdev.c index 29b44a576e..31b66ccb89 100644 --- a/blockdev.c +++ b/blockdev.c @@ -334,7 +334,7 @@ static DriveInfo *blockdev_init(QDict *bs_opts, opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error); if (error_is_set(&error)) { error_propagate(errp, error); - return NULL; + goto err_no_opts; } qemu_opts_absorb_qdict(opts, bs_opts, &error); @@ -535,8 +535,9 @@ err: QTAILQ_REMOVE(&drives, dinfo, next); g_free(dinfo); early_err: - QDECREF(bs_opts); qemu_opts_del(opts); +err_no_opts: + QDECREF(bs_opts); return NULL; } |