mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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.
This commit is contained in:
parent
cb31d618fd
commit
727a3c5860
@ -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)
|
||||||
@ -519,7 +520,6 @@ qemuParseCommandLineVnc(virDomainDefPtr def,
|
|||||||
char *opts;
|
char *opts;
|
||||||
char *port;
|
char *port;
|
||||||
const char *sep = ":";
|
const char *sep = ":";
|
||||||
char *listenAddr = NULL;
|
|
||||||
if (val[0] == '[')
|
if (val[0] == '[')
|
||||||
sep = "]:";
|
sep = "]:";
|
||||||
tmp = strstr(val, sep);
|
tmp = strstr(val, sep);
|
||||||
@ -614,6 +614,7 @@ qemuParseCommandLineVnc(virDomainDefPtr def,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainGraphicsDefFree(vnc);
|
virDomainGraphicsDefFree(vnc);
|
||||||
|
VIR_FREE(listenAddr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +240,7 @@ xenParseXLSpice(virConfPtr conf, virDomainDefPtr def)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
VIR_FREE(listenAddr);
|
||||||
virDomainGraphicsDefFree(graphics);
|
virDomainGraphicsDefFree(graphics);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user