summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-05-28 11:16:59 +0200
committerKevin Wolf <kwolf@redhat.com>2014-05-30 14:26:54 +0200
commit29f2601aa605f0af0cba8eedcff7812c6c8532e9 (patch)
treef8a7d90b237d60da81672a172a0240f960d09a93
parent443422fde7cb8410849074181de7b91bfd13b19d (diff)
downloadhqemu-29f2601aa605f0af0cba8eedcff7812c6c8532e9.zip
hqemu-29f2601aa605f0af0cba8eedcff7812c6c8532e9.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>
-rw-r--r--qemu-io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/qemu-io.c b/qemu-io.c
index ef3fef6..f63e771 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;
}
@@ -175,6 +176,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);
}
}
OpenPOWER on IntegriCloud