]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Resolve a couple of memory leaks
authorJohn Ferlan <jferlan@redhat.com>
Thu, 14 Apr 2016 14:21:27 +0000 (10:21 -0400)
committerCole Robinson <crobinso@redhat.com>
Wed, 20 Apr 2016 13:25:23 +0000 (09:25 -0400)
Commit id '4b75237f' seems to have triggered Coverity into finding
at least one memory leak in xen_xl.c for error path for cleanup where
the listenAddr would be leaked. Reviewing other callers, it seems that
qemu_parse_command.c would have the same issue, so just it too.

(cherry picked from commit 727a3c5860ef5e1fb8878da9d44c6e5e33a4f4ae)

src/qemu/qemu_parse_command.c
src/xenconfig/xen_xl.c

index 8b294a7df02a93ee219498ada51db61c3f3ac44d..45b64a6eaf19b739a6566b8c144055fd340feda0 100644 (file)
@@ -500,6 +500,7 @@ qemuParseCommandLineVnc(virDomainDefPtr def,
 {
     int ret = -1;
     virDomainGraphicsDefPtr vnc = NULL;
+    char *listenAddr = NULL;
     char *tmp;
 
     if (VIR_ALLOC(vnc) < 0)
@@ -612,6 +613,7 @@ qemuParseCommandLineVnc(virDomainDefPtr def,
 
  cleanup:
     virDomainGraphicsDefFree(vnc);
+    VIR_FREE(listenAddr);
     return ret;
 }
 
index 98a7fa6a26e7b8265c8611b9a7d503897b0a1ef3..aa09ae243c1e4b6c0f67a31689a3f08ff1e2bccf 100644 (file)
@@ -242,6 +242,7 @@ xenParseXLSpice(virConfPtr conf, virDomainDefPtr def)
     return 0;
 
  cleanup:
+    VIR_FREE(listenAddr);
     virDomainGraphicsDefFree(graphics);
     return -1;
 }