Skip to contentSkip to conversation

block: bdrv_create(): don't leak cco.filename on error

PATCH Applied Luiz Capitulino 3 participants 3 messages Oct 17, 2012 – Oct 18, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: bdrv_create(): don't leak cco.filename on error

---
 block.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
block.c +4 -2
index 5e8184f..63bf768 100644
@@ -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;
 }
 
Signature · 1 line
1.7.12.315.g682ce8b