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:
John Ferlan 2014-08-22 11:01:04 -04:00
parent e1d0471e58
commit cc1bbbbeba

View File

@ -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;