]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
block: bdrv_create(): don't leak cco.filename on error
authorLuiz Capitulino <lcapitulino@redhat.com>
Wed, 17 Oct 2012 19:45:25 +0000 (16:45 -0300)
committerKevin Wolf <kwolf@redhat.com>
Wed, 24 Oct 2012 08:26:19 +0000 (10:26 +0200)
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c

diff --git a/block.c b/block.c
index 5e7fc9eb27e34d5503803ef445b1429cac2fd4bb..7e26b6fa4f2d9805bd84306d9f74b37fa41811e2 100644 (file)
--- a/block.c
+++ b/block.c
@@ -379,7 +379,8 @@ int bdrv_create(BlockDriver *drv, const char* filename,
     };
 
     if (!drv->bdrv_create) {
-        return -ENOTSUP;
+        ret = -ENOTSUP;
+        goto out;
     }
 
     if (qemu_in_coroutine()) {
@@ -394,8 +395,9 @@ int bdrv_create(BlockDriver *drv, const char* filename,
     }
 
     ret = cco.ret;
-    g_free(cco.filename);
 
+out:
+    g_free(cco.filename);
     return ret;
 }