From: Jérémie Galarneau Date: Sun, 30 Aug 2015 22:50:39 +0000 (-0400) Subject: Fix: Memory leak of agent X-Git-Tag: v2.6.1~64 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b7d4697229a632cc7ee7c36bf333636682944444;p=lttng-tools.git Fix: Memory leak of agent 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 --- diff --git a/src/bin/lttng-sessiond/agent.c b/src/bin/lttng-sessiond/agent.c index 3e70701b2..c0b8a218b 100644 --- a/src/bin/lttng-sessiond/agent.c +++ b/src/bin/lttng-sessiond/agent.c @@ -919,8 +919,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) { @@ -959,6 +958,7 @@ void agent_destroy(struct agent *agt) rcu_read_unlock(); ht_cleanup_push(agt->events); + free(agt); } /*