The lttng poll clean call is slightly changed to handle negative epoll
fd so we don't close anything blindly creating perror() outputs for
nothing.
Issue
1019895 of coverity scan.
Signed-off-by: David Goulet <dgoulet@efficios.com>
rcu_register_thread();
+ /* We might hit an error path before this is set once. */
+ memset(&events, 0, sizeof(events));
+ events.epfd = -1;
+
/* Create unix socket */
sock = lttcomm_create_unix_sock(health_unix_sock_path);
if (sock < 0) {
{
int ret;
- if (events) {
+ if (!events) {
+ return;
+ }
+
+ if (events->epfd >= 0) {
ret = close(events->epfd);
if (ret) {
perror("close");
}
- __lttng_poll_free((void *) events->events);
}
+
+ __lttng_poll_free((void *) events->events);
}
#else /* HAVE_EPOLL */