提交 59a3b795 编写于 作者: J John Ferlan

tests: Fix memory leak in mymain

Commit d2899a64 added a new exit path, but didn't free @fakerootdir.
Let's just use VIR_AUTOFREE instead to make life easier.

Found by Coverity
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 4e02d52a
......@@ -556,7 +556,7 @@ static int
mymain(void)
{
int ret = 0;
char *fakerootdir;
VIR_AUTOFREE(char *) fakerootdir = NULL;
if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
fprintf(stderr, "Out of memory\n");
......@@ -594,8 +594,6 @@ mymain(void)
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);
VIR_FREE(fakerootdir);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册