agent: avoid leak of turn refreshes
authorFabrice Bellet <fabrice@bellet.info>
Sun, 13 Dec 2020 16:59:41 +0000 (17:59 +0100)
committerOlivier CrĂȘte <olivier.crete@ocrete.ca>
Tue, 20 Apr 2021 19:37:08 +0000 (19:37 +0000)
We keep refreshes having the discarding flag set. They may be freed later
if the agent main context remains alive after agent deletion.

agent/agent.c

index c15f835..8d2349a 100644 (file)
@@ -5629,6 +5629,15 @@ nice_agent_dispose (GObject *object)
         "using nice_agent_close_async() to prune them before releasing the "
         "agent.", agent);
 
+  for (i = agent->refresh_list; i;) {
+    GSList *next = i->next;
+    CandidateRefresh *refresh = i->data;
+
+    if (!refresh->disposing)
+      refresh_free (agent, refresh);
+    i = next;
+  }
+
   g_free (agent->stun_server_ip);
   agent->stun_server_ip = NULL;