X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Fpoll.h;h=e69d59b42d054efbc900fd5412db093362fc5190;hb=3cc048812bf25b42003b40b6b868b9366faefafb;hp=9e889767f8321a05ea23f97c211086cf0c6e3836;hpb=36134aa184c8ed8f67a197d66d1310425abbf1ce;p=lttng-tools.git diff --git a/src/common/compat/poll.h b/src/common/compat/poll.h index 9e889767f..e69d59b42 100644 --- a/src/common/compat/poll.h +++ b/src/common/compat/poll.h @@ -166,13 +166,18 @@ static inline void lttng_poll_clean(struct lttng_poll_event *events) { 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 */