mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
util: avoid fds leak when virEventPollAddHandle fail
* src/util/event_poll.c: avoid file descriptors leak when virEventPollAddHandle fail on virEventPollInit function.
This commit is contained in:
parent
74594c57f1
commit
463e8c2ff0
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user