* src/qemu/qemu_conf.c (qemudBuildCommandLine): Don't leak
rbd_hosts.
---

Leak introduced post-0.8.6.

 src/qemu/qemu_conf.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index fb0b29a..4f19037 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -4765,8 +4765,11 @@ qemudBuildCommandLine(virConnectPtr conn,
         virBufferFreeAndReset(&rbd_hosts);
         goto no_memory;
     }
-    if (has_rbd_hosts)
-        virCommandAddEnvPair(cmd, "CEPH_ARGS", 
virBufferContentAndReset(&rbd_hosts));
+    if (has_rbd_hosts) {
+        char *optstr = virBufferContentAndReset(&rbd_hosts);
+        virCommandAddEnvPair(cmd, "CEPH_ARGS", optstr);
+        VIR_FREE(optstr);
+    }

     if (qemuCmdFlags & QEMUD_CMD_FLAG_FSDEV) {
         for (i = 0 ; i < def->nfss ; i++) {
@@ -5516,6 +5519,7 @@ qemudBuildCommandLine(virConnectPtr conn,
  error:
     for (i = 0; i <= last_good_net; i++)
         virDomainConfNWFilterTeardown(def->nets[i]);
+    virBufferFreeAndReset(&rbd_hosts);
     virCommandFree(cmd);
     return NULL;
 }
-- 
1.7.3.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to