mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virfile: Resolve Coverity RESOURCE_LEAK
With the virGetGroupList() change in place - Coverity further complains that if we fail to virFork(), the groups will be leaked - which aha seems to be the case. Adjust the logic to save off the -errno, free the groups, and then return the value we saved Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
52e90b22cc
commit
8d44f924ce
@ -2000,8 +2000,11 @@ virFileOpenForked(const char *path, int openflags, mode_t mode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pid = virFork();
|
pid = virFork();
|
||||||
if (pid < 0)
|
if (pid < 0) {
|
||||||
return -errno;
|
ret = -errno;
|
||||||
|
VIR_FREE(groups);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user