Fix: consumer: dangling chunk on buffer allocation failure
[lttng-tools.git] / src / bin / lttng-sessiond / ust-app.c
index a4fea821a07d35cb45670879cbab3ad2d00da711..8c314ec1c9688d5df77c1eefc8fa047988e0d474 100644 (file)
@@ -4112,11 +4112,14 @@ int ust_app_channel_create(struct ltt_ust_session *usess,
                ret = ust_app_channel_allocate(ua_sess, uchan,
                        LTTNG_UST_CHAN_PER_CPU, usess,
                        &ua_chan);
-               if (ret == 0) {
-                       ret = ust_app_channel_send(app, usess,
-                               ua_sess, ua_chan);
-               } else {
-                       goto end;
+               if (ret < 0) {
+                       goto error;
+               }
+
+               ret = ust_app_channel_send(app, usess,
+                       ua_sess, ua_chan);
+               if (ret) {
+                       goto error;
                }
 
                /* Add contexts. */
@@ -4124,10 +4127,12 @@ int ust_app_channel_create(struct ltt_ust_session *usess,
                        ret = create_ust_app_channel_context(ua_chan,
                                &uctx->ctx, app);
                        if (ret) {
-                               goto end;
+                               goto error;
                        }
                }
        }
+
+error:
        if (ret < 0) {
                switch (ret) {
                case -ENOTCONN:
@@ -4143,7 +4148,7 @@ int ust_app_channel_create(struct ltt_ust_session *usess,
                        break;
                }
        }
-end:
+
        if (ret == 0 && _ua_chan) {
                /*
                 * Only return the application's channel on success. Note
This page took 0.025485 seconds and 5 git commands to generate.