Fix agent leak in case component socket is reset remotely
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Sat, 29 Aug 2015 19:04:03 +0000 (20:04 +0100)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Sat, 29 Aug 2015 19:04:03 +0000 (20:04 +0100)
Summary: The patch fixes the issue where agent reference count is not properly decremented causing instance leak in cases where component's socket is reset remotely.

Reviewers: #libnice, pwithnall

Projects: #libnice

Reviewed By: #libnice, pwithnall

Subscribers: pwithnall, maximgolunov

Differential Revision: https://phabricator.freedesktop.org/D236

agent/agent.c

index 77450c3..09945f1 100644 (file)
@@ -1700,7 +1700,6 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data)
 out:
 
   g_object_unref (agent);
-
 }
 
 static void
@@ -4775,6 +4774,7 @@ component_io_cb (GSocket *gsocket, GIOCondition condition, gpointer user_data)
 
     component_detach_socket (component, socket_source->socket);
     agent_unlock ();
+    g_object_unref (agent);
     return G_SOURCE_REMOVE;
   }
 
@@ -4945,6 +4945,7 @@ done:
 
 out:
   g_object_unref (agent);
+
   agent_unlock_and_emit (agent);
   return G_SOURCE_REMOVE;
 }