mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
tests: Fix memory leak in mymain
Commit 944a35d7f0
added @fakerootdir; however, there are multiple
paths out of mymain that didn't free the memory - so just use the
g_autofree to resolve the potential leak.
Found by Coverity
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
d343e8203d
commit
2669edabd3
@ -595,7 +595,7 @@ mymain(void)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct qemuHotplugTestData data = {0};
|
struct qemuHotplugTestData data = {0};
|
||||||
struct testQemuHotplugCpuParams cpudata;
|
struct testQemuHotplugCpuParams cpudata;
|
||||||
char *fakerootdir;
|
g_autofree char *fakerootdir = NULL;
|
||||||
|
|
||||||
fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE);
|
fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE);
|
||||||
|
|
||||||
@ -875,7 +875,6 @@ mymain(void)
|
|||||||
|
|
||||||
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
|
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
|
||||||
virFileDeleteTree(fakerootdir);
|
virFileDeleteTree(fakerootdir);
|
||||||
VIR_FREE(fakerootdir);
|
|
||||||
|
|
||||||
qemuTestDriverFree(&driver);
|
qemuTestDriverFree(&driver);
|
||||||
virObjectUnref(data.vm);
|
virObjectUnref(data.vm);
|
||||||
|
Loading…
Reference in New Issue
Block a user