Fix: double unlock of metadata mutex on error
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index 82d56ebb796910b28b86f417f7ec0f64a08de42b..7bbfa60a26fc6f90aed740869b0773994cd86ca2 100644 (file)
@@ -2273,10 +2273,10 @@ int lttng_ustconsumer_sync_metadata(struct lttng_consumer_local_data *ctx,
         * because we locked the metadata thread.
         */
        ret = lttng_ustconsumer_request_metadata(ctx, metadata->chan, 0, 0);
+       pthread_mutex_lock(&metadata->lock);
        if (ret < 0) {
                goto end;
        }
-       pthread_mutex_lock(&metadata->lock);
 
        ret = commit_one_metadata_packet(metadata);
        if (ret <= 0) {
@@ -2630,6 +2630,7 @@ int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
                        if (!index_file) {
                                goto error;
                        }
+                       assert(!stream->index_file);
                        stream->index_file = index_file;
                }
        }
This page took 0.025025 seconds and 5 git commands to generate.