Fix: Metadata stream leak when received in consumer
[lttng-tools.git] / src / common / consumer.c
index a9e4dee661b1d1ba13da01a2db4d74ee16f68e8e..53806b08d8ee4a0dcd54b80ee71edaca221fd784 100644 (file)
@@ -1723,20 +1723,13 @@ restart:
                                        close(ctx->consumer_metadata_pipe[0]);
                                        continue;
                                } else if (revents & LPOLLIN) {
-                                       stream = zmalloc(sizeof(struct lttng_consumer_stream));
-                                       if (stream == NULL) {
-                                               PERROR("zmalloc metadata consumer stream");
-                                               goto error;
-                                       }
-
                                        do {
-                                               /* Get the stream and add it to the local hash table */
-                                               ret = read(pollfd, stream,
-                                                               sizeof(struct lttng_consumer_stream));
+                                               /* Get the stream pointer received */
+                                               ret = read(pollfd, &stream, sizeof(stream));
                                        } while (ret < 0 && errno == EINTR);
-                                       if (ret < 0 || ret < sizeof(struct lttng_consumer_stream)) {
+                                       if (ret < 0 ||
+                                                       ret < sizeof(struct lttng_consumer_stream *)) {
                                                PERROR("read metadata stream");
-                                               free(stream);
                                                /*
                                                 * Let's continue here and hope we can still work
                                                 * without stopping the consumer. XXX: Should we?
This page took 0.023509 seconds and 4 git commands to generate.