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

login
register
mail settings
Submitter Stefan Hajnoczi
Date Dec. 7, 2010, 9:35 a.m.
Message ID <1291714556-22961-4-git-send-email-stefanha@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/74497/
State New
Headers show

Comments

Stefan Hajnoczi - Dec. 7, 2010, 9:35 a.m.
Free option parameter lists in the img_create() error return path.

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

Patch

diff --git a/qemu-img.c b/qemu-img.c
index 5b6e648..23bb7dc 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -439,8 +439,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) {
@@ -452,6 +450,8 @@  static int img_create(int argc, char **argv)
         }
     }
 out:
+    free_option_parameters(create_options);
+    free_option_parameters(param);
     if (ret) {
         return 1;
     }