[PATCH 3/4] qemu: plug memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* 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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]