Fix: free metadata cache after grace period in consumer
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index 7dfcf9a3cf46381675222dfbcb94a474e0e8eaa9..d45707b763deaf653b3ed75f65c80a3f5ed42b55 100644 (file)
@@ -82,6 +82,7 @@ static void destroy_channel(struct lttng_consumer_channel *channel)
         */
        if (channel->uchan) {
                lttng_ustconsumer_del_channel(channel);
         */
        if (channel->uchan) {
                lttng_ustconsumer_del_channel(channel);
+               lttng_ustconsumer_free_channel(channel);
        }
        free(channel);
 }
        }
        free(channel);
 }
@@ -1830,8 +1831,6 @@ void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
        if (chan->switch_timer_enabled == 1) {
                consumer_timer_switch_stop(chan);
        }
        if (chan->switch_timer_enabled == 1) {
                consumer_timer_switch_stop(chan);
        }
-       consumer_metadata_cache_destroy(chan);
-       ustctl_destroy_channel(chan->uchan);
        for (i = 0; i < chan->nr_stream_fds; i++) {
                int ret;
 
        for (i = 0; i < chan->nr_stream_fds; i++) {
                int ret;
 
@@ -1852,7 +1851,6 @@ void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
                        }
                }
        }
                        }
                }
        }
-       free(chan->stream_fds);
        /* Try to rmdir all directories under shm_path root. */
        if (chan->root_shm_path[0]) {
                (void) run_as_recursive_rmdir(chan->root_shm_path,
        /* Try to rmdir all directories under shm_path root. */
        if (chan->root_shm_path[0]) {
                (void) run_as_recursive_rmdir(chan->root_shm_path,
@@ -1860,6 +1858,16 @@ void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
        }
 }
 
        }
 }
 
+void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
+{
+       assert(chan);
+       assert(chan->uchan);
+
+       consumer_metadata_cache_destroy(chan);
+       ustctl_destroy_channel(chan->uchan);
+       free(chan->stream_fds);
+}
+
 void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
 {
        assert(stream);
 void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
 {
        assert(stream);
This page took 0.023833 seconds and 4 git commands to generate.