提交 463e8c2f 编写于 作者: A Alex Jia 提交者: Eric Blake

util: avoid fds leak when virEventPollAddHandle fail

* src/util/event_poll.c: avoid file descriptors leak when
  virEventPollAddHandle fail on virEventPollInit function.
上级 74594c57
......@@ -36,6 +36,7 @@
#include "event_poll.h"
#include "memory.h"
#include "util.h"
#include "files.h"
#include "ignore-value.h"
#include "virterror_internal.h"
......@@ -657,6 +658,8 @@ int virEventPollInit(void)
virEventError(VIR_ERR_INTERNAL_ERROR,
_("Unable to add handle %d to event loop"),
eventLoop.wakeupfd[0]);
VIR_FORCE_CLOSE(eventLoop.wakeupfd[0]);
VIR_FORCE_CLOSE(eventLoop.wakeupfd[1]);
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册