cppcheck: don't check NULL pointer before freeing them
[lttng-tools.git] / src / common / consumer.c
index 15fc9b09f800d6225be465b0d3c993e69a279f09..8bcfa45ebd746fd6be782c6259790ba9391168f8 100644 (file)
@@ -2283,14 +2283,11 @@ void *consumer_thread_data_poll(void *data)
                 */
                pthread_mutex_lock(&consumer_data.lock);
                if (consumer_data.need_update) {
-                       if (pollfd != NULL) {
-                               free(pollfd);
-                               pollfd = NULL;
-                       }
-                       if (local_stream != NULL) {
-                               free(local_stream);
-                               local_stream = NULL;
-                       }
+                       free(pollfd);
+                       pollfd = NULL;
+
+                       free(local_stream);
+                       local_stream = NULL;
 
                        /* allocate for all fds + 1 for the consumer_data_pipe */
                        pollfd = zmalloc((consumer_data.stream_count + 1) * sizeof(struct pollfd));
@@ -2487,14 +2484,8 @@ void *consumer_thread_data_poll(void *data)
        }
 end:
        DBG("polling thread exiting");
-       if (pollfd != NULL) {
-               free(pollfd);
-               pollfd = NULL;
-       }
-       if (local_stream != NULL) {
-               free(local_stream);
-               local_stream = NULL;
-       }
+       free(pollfd);
+       free(local_stream);
 
        /*
         * Close the write side of the pipe so epoll_wait() in
This page took 0.026463 seconds and 5 git commands to generate.