1
0
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:
John Ferlan 2014-09-11 17:05:34 -04:00
parent 52e90b22cc
commit 8d44f924ce

View File

@ -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) {