From: Jérémie Galarneau Date: Tue, 20 Dec 2016 20:00:04 +0000 (-0500) Subject: Fix: double unlock of metadata mutex on error X-Git-Tag: v2.9.1~3 X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=87f05398efb9985607b1a312f58abfaee2ecc453;p=lttng-tools.git Fix: double unlock of metadata mutex on error 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 --- diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index c7f208b8d..faf069c0d 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) {