Fix: create_channel_per_pid: remove channel on error
[lttng-tools.git] / src / bin / lttng-sessiond / ust-app.c
index f97d869e6900fc9a9efd9903e67c164b0f78fc08..2c1b845adf56bc35ef2ec1875599e2c2113904ae 100644 (file)
@@ -3019,7 +3019,7 @@ static int create_channel_per_pid(struct ust_app *app,
        if (ret < 0) {
                ERR("Error creating UST channel \"%s\" on the consumer daemon",
                        ua_chan->name);
-               goto error;
+               goto error_remove_from_registry;
        }
 
        ret = send_channel_pid_to_ust(app, ua_sess, ua_chan);
@@ -3027,7 +3027,7 @@ static int create_channel_per_pid(struct ust_app *app,
                if (ret != -ENOTCONN) {
                        ERR("Error sending channel to application");
                }
-               goto error;
+               goto error_remove_from_registry;
        }
 
        chan_reg_key = ua_chan->key;
@@ -3047,9 +3047,13 @@ static int create_channel_per_pid(struct ust_app *app,
        if (cmd_ret != LTTNG_OK) {
                ret = - (int) cmd_ret;
                ERR("Failed to add channel to notification thread");
-               goto error;
+               goto error_remove_from_registry;
        }
 
+error_remove_from_registry:
+       if (ret) {
+               ust_registry_channel_del_free(registry, ua_chan->key, false);
+       }
 error:
        rcu_read_unlock();
        return ret;
This page took 0.023901 seconds and 4 git commands to generate.