diff mbox

[061/108] qemu-io: Plug memory leak in open command

Message ID 1407357598-21541-62-git-send-email-mdroth@linux.vnet.ibm.com
State New
Headers show

Commit Message

Michael Roth Aug. 6, 2014, 8:39 p.m. UTC
From: Markus Armbruster <armbru@redhat.com>

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 | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/qemu-io.c b/qemu-io.c
index 5d7b53f..bc1277d 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);
     }
 }