Patchwork [13/14] qemu-img: Free option parameter lists in img_create()

login
register
mail settings
Submitter Kevin Wolf
Date Dec. 9, 2010, 11:10 a.m.
Message ID <1291893010-29223-14-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/75025/
State New
Headers show

Comments

Kevin Wolf - Dec. 9, 2010, 11:10 a.m.
From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

Free option parameter lists in the img_create() error return path.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-img.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/qemu-img.c b/qemu-img.c
index d146d8c..c5a173c 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -428,8 +428,6 @@  static int img_create(int argc, char **argv)
     puts("");
 
     ret = bdrv_create(drv, filename, param);
-    free_option_parameters(create_options);
-    free_option_parameters(param);
 
     if (ret < 0) {
         if (ret == -ENOTSUP) {
@@ -441,6 +439,8 @@  static int img_create(int argc, char **argv)
         }
     }
 out:
+    free_option_parameters(create_options);
+    free_option_parameters(param);
     if (ret) {
         return 1;
     }