From 58650d53c7974bf289a5f13c7f437cf9dd67d5a7 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Thu, 14 Apr 2016 10:21:27 -0400 Subject: [PATCH] Resolve a couple of memory leaks 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 | 2 ++ src/xenconfig/xen_xl.c | 1 + 2 files changed, 3 insertions(+) diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index 8b294a7df0..45b64a6eaf 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -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; } diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 98a7fa6a26..aa09ae243c 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -242,6 +242,7 @@ xenParseXLSpice(virConfPtr conf, virDomainDefPtr def) return 0; cleanup: + VIR_FREE(listenAddr); virDomainGraphicsDefFree(graphics); return -1; }