Fix: channel leak on error
[lttng-ust.git] / liblttng-ust / lttng-ust-comm.c
index e449edad0ad1916cb09ca3bcc070f49e6574d22d..18063ffed722523c212d0db796831396a3a36aab 100644 (file)
@@ -923,6 +923,17 @@ int handle_message(struct sock_info *sock_info,
                                        &args, sock_info);
                else
                        ret = -ENOSYS;
+               if (args.channel.wakeup_fd >= 0) {
+                       int close_ret;
+
+                       lttng_ust_lock_fd_tracker();
+                       close_ret = close(args.channel.wakeup_fd);
+                       lttng_ust_unlock_fd_tracker();
+                       args.channel.wakeup_fd = -1;
+                       if (close_ret)
+                               PERROR("close");
+               }
+               free(args.channel.chan_data);
                break;
        }
        case LTTNG_UST_STREAM:
This page took 0.023823 seconds and 4 git commands to generate.