From 07d2ae956551db46c137f85847a6d2972b1b0c9d Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 28 May 2013 17:58:44 -0400 Subject: [PATCH] Fix: add missing buffer registry cleanup on error Fixes #542 Signed-off-by: David Goulet --- src/bin/lttng-sessiond/buffer-registry.c | 3 +-- src/bin/lttng-sessiond/ust-app.c | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/bin/lttng-sessiond/buffer-registry.c b/src/bin/lttng-sessiond/buffer-registry.c index 2df98d736..6a35284fe 100644 --- a/src/bin/lttng-sessiond/buffer-registry.c +++ b/src/bin/lttng-sessiond/buffer-registry.c @@ -492,8 +492,7 @@ void buffer_reg_channel_destroy(struct buffer_reg_channel *regp, return; } - DBG3("Buffer registry channel destroy with key %" PRIu32 " and handle %d", - regp->key, regp->obj.ust->handle); + DBG3("Buffer registry channel destroy with key %" PRIu32, regp->key); switch (domain) { case LTTNG_DOMAIN_UST: diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index dfc4599be..4fb23b627 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -2246,6 +2246,14 @@ static int create_channel_per_uid(struct ust_app *app, ret = do_consumer_create_channel(usess, ua_sess, ua_chan, app->bits_per_long, reg_uid->registry->reg.ust); if (ret < 0) { + /* + * Let's remove the previously created buffer registry channel so + * it's not visible anymore in the session registry. + */ + ust_registry_channel_del_free(reg_uid->registry->reg.ust, + ua_chan->tracing_channel_id); + buffer_reg_channel_remove(reg_uid->registry, reg_chan); + buffer_reg_channel_destroy(reg_chan, LTTNG_DOMAIN_UST); goto error; } -- 2.34.1