From 8633d6e39669efa669d6ef21a1854bca0170138f Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 30 Apr 2013 10:25:21 -0400 Subject: [PATCH] Fix consumerd fd leak Refcount is only incremented and owned by thread management for streams, not metadata. Signed-off-by: Mathieu Desnoyers --- src/common/ust-consumer/ust-consumer.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 44a8240b0..03c00a677 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -859,13 +859,6 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, goto end_channel_error; } - /* - * Set refcount to 1 for owner. Below, we will pass - * ownership to the consumer_thread_channel_poll() - * thread. - */ - channel->refcount = 1; - /* Build channel attributes from received message. */ attr.subbuf_size = msg.u.ask_channel.subbuf_size; attr.num_subbuf = msg.u.ask_channel.num_subbuf; @@ -890,6 +883,12 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, case LTTNG_UST_CHAN_PER_CPU: channel->type = CONSUMER_CHANNEL_TYPE_DATA; attr.type = LTTNG_UST_CHAN_PER_CPU; + /* + * Set refcount to 1 for owner. Below, we will + * pass ownership to the + * consumer_thread_channel_poll() thread. + */ + channel->refcount = 1; break; case LTTNG_UST_CHAN_METADATA: channel->type = CONSUMER_CHANNEL_TYPE_METADATA; -- 2.34.1