From 1caeb2ebea17673efa6123f060fd77d2cc0df7ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 20 Dec 2016 15:00:04 -0500 Subject: [PATCH] Fix: double unlock of metadata mutex on error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit lttng_ustconsumer_sync_metadata must leave the metadata lock in its initial state. Otherwise an error may result in a double unlock in the caller. Signed-off-by: Jérémie Galarneau --- src/common/ust-consumer/ust-consumer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 5c7b00317..7bbfa60a2 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -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) { -- 2.34.1