mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
virnetsocket: Resolve Coverity RESOURCE_LEAK
Since '1b807f92d' - Coverity complains that in the error paths of both virFork() and virProcessWait() that the 'passfd' will not be closed. Added the VIR_FORCE_CLOSE(passfd) and initialized it to -1. Also noted that variable 'buf' was never really used - so I removed it
This commit is contained in:
parent
e1d0471e58
commit
cc1bbbbeba
@ -544,8 +544,7 @@ int virNetSocketNewConnectUNIX(const char *path,
|
||||
const char *binary,
|
||||
virNetSocketPtr *retsock)
|
||||
{
|
||||
char *buf = NULL;
|
||||
int fd, passfd;
|
||||
int fd, passfd = -1;
|
||||
virSocketAddr localAddr;
|
||||
virSocketAddr remoteAddr;
|
||||
|
||||
@ -647,8 +646,8 @@ int virNetSocketNewConnectUNIX(const char *path,
|
||||
return 0;
|
||||
|
||||
error:
|
||||
VIR_FREE(buf);
|
||||
VIR_FORCE_CLOSE(fd);
|
||||
VIR_FORCE_CLOSE(passfd);
|
||||
if (spawnDaemon)
|
||||
unlink(path);
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user