Fix: double unlock of metadata mutex on error
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 20 Dec 2016 20:00:04 +0000 (15:00 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 20 Dec 2016 21:01:25 +0000 (16:01 -0500)
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 <jeremie.galarneau@efficios.com>
src/common/ust-consumer/ust-consumer.c

index c7f208b8dfe3006e89751f6416cf185216efdcd0..faf069c0df6f9319a53751a532cc5e88e769ca26 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) {
This page took 0.035016 seconds and 4 git commands to generate.