[Pkg-telepathy-commits] [libnice] 217/265: agent: Fix leaks if a component is removed during a recv() call
Simon McVittie
smcv at debian.org
Wed May 14 12:05:10 UTC 2014
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian
in repository libnice.
commit 1d796cfacd2db2082d83395250565624f1ce5415
Author: Philip Withnall <philip.withnall at collabora.co.uk>
Date: Wed Apr 16 19:09:06 2014 +0100
agent: Fix leaks if a component is removed during a recv() call
If the error handling block in the middle of the recv() loop is hit,
various things were previously leaked (context, cancellable_source) and
the return values were potentially incorrect.
Fix the break out of the error handling block to clean up correctly.
---
agent/agent.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/agent/agent.c b/agent/agent.c
index d91b77d..a7a8564 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -3335,7 +3335,6 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent,
memcpy (&prev_recv_messages_iter, &component->recv_messages_iter,
sizeof (NiceInputMessageIter));
-
agent_unlock_and_emit (agent);
g_main_context_iteration (context, blocking);
agent_lock ();
@@ -3344,7 +3343,11 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent,
&stream, &component)) {
g_set_error (&child_error, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE,
"Component removed during call.");
- goto done;
+
+ component = NULL;
+ error_reported = TRUE;
+
+ goto recv_error;
}
received_enough =
@@ -3360,13 +3363,15 @@ nice_agent_recv_messages_blocking_or_nonblocking (NiceAgent *agent,
nice_input_message_iter_get_n_valid_messages (
&component->recv_messages_iter); /* grab before resetting the iter */
- /* Tidy up. */
+ component_set_io_callback (component, NULL, NULL, NULL, 0, NULL);
+
+recv_error:
+ /* Tidy up. Below this point, @component may be %NULL. */
if (cancellable_source != NULL) {
g_source_destroy (cancellable_source);
g_source_unref (cancellable_source);
}
- component_set_io_callback (component, NULL, NULL, NULL, 0, NULL);
g_main_context_unref (context);
/* Handle errors and cancellations. */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git
More information about the Pkg-telepathy-commits
mailing list