Fix: Uninitialized pointer read
[lttng-tools.git] / src / common / compat / poll.h
index 9e889767f8321a05ea23f97c211086cf0c6e3836..e69d59b42d054efbc900fd5412db093362fc5190 100644 (file)
@@ -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 */
This page took 0.023137 seconds and 4 git commands to generate.