From: Mathieu Desnoyers Date: Fri, 7 Feb 2014 16:54:06 +0000 (-0500) Subject: Fix: FD leak in liblttng-ust-ctl X-Git-Tag: v2.2.3~1 X-Git-Url: http://git.liburcu.org/?p=lttng-ust.git;a=commitdiff_plain;h=1584cac2fb5dea4531f529b73a62eaccb95da897 Fix: FD leak in liblttng-ust-ctl Make sure wait/wakeup stream and channel FDs are closed at teardown. This led to FD leaks on the consumer daemon when the relay daemon disconnects unexpectedly. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index 0361f184..c22f5785 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -977,6 +977,8 @@ chan_error: void ustctl_destroy_channel(struct ustctl_consumer_channel *chan) { + (void) ustctl_channel_close_wait_fd(chan); + (void) ustctl_channel_close_wakeup_fd(chan); chan->chan->ops->channel_destroy(chan->chan); free(chan); } @@ -1151,6 +1153,8 @@ void ustctl_destroy_stream(struct ustctl_consumer_stream *stream) assert(stream); buf = stream->buf; consumer_chan = stream->chan; + (void) ustctl_stream_close_wait_fd(stream); + (void) ustctl_stream_close_wakeup_fd(stream); lib_ring_buffer_release_read(buf, consumer_chan->chan->handle); free(stream); }