]> xenbits.xensource.com Git - qemu-upstream-4.6-testing.git/commitdiff
qemu-io: Plug memory leak in open command
authorMarkus Armbruster <armbru@redhat.com>
Wed, 28 May 2014 09:16:59 +0000 (11:16 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 5 Aug 2014 16:42:09 +0000 (11:42 -0500)
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>
qemu-io.c

index 5d7b53f7567d071ce2b7667945d9d0866c081f59..bc1277d0964dc4e1dae8a9572029f719e321832d 100644 (file)
--- 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);
     }
 }