summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-05-28 11:16:59 +0200
committerMichael Roth <mdroth@linux.vnet.ibm.com>2014-08-05 11:42:09 -0500
commit5e3322eec31e6198c5370a1f01c6e1429548ebcb (patch)
treea394f3217c9873ff7024049215839132c1957a6b
parent5a0913f782a5d73a274b1fb39ec7d4d9a79ad4ca (diff)
downloadqemu-5e3322eec31e6198c5370a1f01c6e1429548ebcb.tar.gz
qemu-io: Plug memory leak in open command
Introduced in commit b543c5c. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 29f2601aa605f0af0cba8eedcff7812c6c8532e9) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r--qemu-io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/qemu-io.c b/qemu-io.c
index 5d7b53f756..bc1277d096 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -54,6 +54,7 @@ static int openfile(char *name, int flags, int growable, QDict *opts)
if (qemuio_bs) {
fprintf(stderr, "file open already, try 'help close'\n");
+ QDECREF(opts);
return 1;
}
@@ -171,6 +172,7 @@ static int open_f(BlockDriverState *bs, int argc, char **argv)
} else if (optind == argc) {
return openfile(NULL, flags, growable, opts);
} else {
+ QDECREF(opts);
return qemuio_command_usage(&open_cmd);
}
}