[libvirt] [PATCH 3/6] qemu: fix memleaks in qemuBuildCommandLine

Zhang Bo oscar.zhangbo at huawei.com
Mon Apr 27 06:41:42 UTC 2015


free boot_opts_str and boot_order_str both in normal and error paths.

Signed-off-by: Zhang Bo <oscar.zhangbo at huawei.com>
---
 src/qemu/qemu_command.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 29b876e..a54f3a3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9266,6 +9266,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     }
     VIR_FREE(boot_opts_str);
+    VIR_FREE(boot_order_str);
 
     if (def->os.kernel)
         virCommandAddArgList(cmd, "-kernel", def->os.kernel, NULL);
@@ -10746,6 +10747,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
  error:
     VIR_FREE(boot_order_str);
+    VIR_FREE(boot_opts_str);
     virBufferFreeAndReset(&boot_buf);
     virObjectUnref(cfg);
     /* free up any resources in the network driver
-- 
1.7.12.4





More information about the libvir-list mailing list