提交 cc1bbbbe 编写于 作者: J John Ferlan

virnetsocket: Resolve Coverity RESOURCE_LEAK

Since '1b807f92' - 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
上级 e1d0471e
无相关合并请求
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部