summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2016-06-06 18:31:22 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2016-06-06 18:31:22 -0400
commit30a0c230ae9b70c572060ad3037f68e102e4759a (patch)
tree88a6727f412de8af71dc56672aba56c016cbca8b
parent71f7ed3eda829c3dc6afe9ed013c0ab826a1aa40 (diff)
downloadlibnice-30a0c230ae9b70c572060ad3037f68e102e4759a.tar.gz
conncheck: Remove pairs before freeing candidate
Remove the whole pair before the candidate is to be freed. https://phabricator.freedesktop.org/T7460
-rw-r--r--agent/conncheck.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index 5cba478..7e03985 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -3671,8 +3671,9 @@ conn_check_prune_socket (NiceAgent *agent, NiceStream *stream, NiceComponent *co
}
/* Prune from the candidate check pairs. */
- for (l = stream->conncheck_list; l != NULL; l = l->next) {
+ for (l = stream->conncheck_list; l != NULL;) {
CandidateCheckPair *p = l->data;
+ GSList *next = l->next;
if ((p->local != NULL && p->local->sockptr == sock) ||
(p->remote != NULL && p->remote->sockptr == sock) ||
@@ -3680,6 +3681,10 @@ conn_check_prune_socket (NiceAgent *agent, NiceStream *stream, NiceComponent *co
nice_debug ("Agent %p : Retransmissions failed, giving up on "
"connectivity check %p", agent, p);
candidate_check_pair_fail (stream, agent, p);
+ conn_check_free_item (p);
+ stream->conncheck_list = g_slist_delete_link (stream->conncheck_list, l);
}
+
+ l = next;
}
}