mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
tests: avoid null pointer dereference
Unlikely to hit in real life, but clang noticed it. * tests/commandtest.c (checkoutput, test4, test18): Avoid unlink(NULL) on OOM.
This commit is contained in:
parent
6e177fa1b6
commit
4b4e8b57c2
@ -78,7 +78,8 @@ static int checkoutput(const char *testname)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
unlink(actualname);
|
if (actualname)
|
||||||
|
unlink(actualname);
|
||||||
VIR_FREE(actuallog);
|
VIR_FREE(actuallog);
|
||||||
VIR_FREE(actualname);
|
VIR_FREE(actualname);
|
||||||
VIR_FREE(expectlog);
|
VIR_FREE(expectlog);
|
||||||
@ -240,7 +241,8 @@ static int test4(const void *unused ATTRIBUTE_UNUSED)
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
unlink(pidfile);
|
if (pidfile)
|
||||||
|
unlink(pidfile);
|
||||||
VIR_FREE(pidfile);
|
VIR_FREE(pidfile);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -703,7 +705,8 @@ static int test18(const void *unused ATTRIBUTE_UNUSED)
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
unlink(pidfile);
|
if (pidfile)
|
||||||
|
unlink(pidfile);
|
||||||
VIR_FREE(pidfile);
|
VIR_FREE(pidfile);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user