From 9fe73c3c8fef5b0d2d958e733e8b39d9eef60600 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sun, 30 Aug 2015 18:50:39 -0400 Subject: [PATCH] Fix: Memory leak of agent MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit agent_destroy() has a comment which indicates that it does _not_ destroy the pointer passed to it and it seems that agents are never realeased under any code path whatsoever. There does not seem to be an instance where an agent is allocated on the stack. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/agent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/lttng-sessiond/agent.c b/src/bin/lttng-sessiond/agent.c index 89f176947..32c261ca7 100644 --- a/src/bin/lttng-sessiond/agent.c +++ b/src/bin/lttng-sessiond/agent.c @@ -927,8 +927,7 @@ void agent_destroy_event(struct agent_event *event) } /* - * Destroy an agent completely. Note that the given pointer is NOT freed - * thus a reference to static or stack data can be passed to this function. + * Destroy an agent completely. */ void agent_destroy(struct agent *agt) { @@ -967,6 +966,7 @@ void agent_destroy(struct agent *agt) rcu_read_unlock(); ht_cleanup_push(agt->events); + free(agt); } /* -- 2.34.1