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 727a3c5860)
This commit is contained in:
John Ferlan 2016-04-14 10:21:27 -04:00 committed by Cole Robinson
parent 06791c14f7
commit 58650d53c7
2 changed files with 3 additions and 0 deletions

View File

@ -500,6 +500,7 @@ qemuParseCommandLineVnc(virDomainDefPtr def,
{ {
int ret = -1; int ret = -1;
virDomainGraphicsDefPtr vnc = NULL; virDomainGraphicsDefPtr vnc = NULL;
char *listenAddr = NULL;
char *tmp; char *tmp;
if (VIR_ALLOC(vnc) < 0) if (VIR_ALLOC(vnc) < 0)
@ -612,6 +613,7 @@ qemuParseCommandLineVnc(virDomainDefPtr def,
cleanup: cleanup:
virDomainGraphicsDefFree(vnc); virDomainGraphicsDefFree(vnc);
VIR_FREE(listenAddr);
return ret; return ret;
} }

View File

@ -242,6 +242,7 @@ xenParseXLSpice(virConfPtr conf, virDomainDefPtr def)
return 0; return 0;
cleanup: cleanup:
VIR_FREE(listenAddr);
virDomainGraphicsDefFree(graphics); virDomainGraphicsDefFree(graphics);
return -1; return -1;
} }