tcpserversink: Don't leak a GSocket and a GInetSocketAddress

when accepting a connection.

Discovered by `make check-valgrind` with the new `socketintegrationtest`.

https://bugzilla.gnome.org/show_bug.cgi?id=739544
This commit is contained in:
William Manley 2014-11-06 14:14:22 +00:00 committed by Sebastian Dröge
parent 5b0ec93e99
commit ffb43c0591
2 changed files with 7 additions and 0 deletions

View file

@ -677,6 +677,10 @@ gst_multi_handle_sink_add_full (GstMultiHandleSink * sink,
if (clink != NULL)
goto duplicate;
/* We do not take ownership of @handle in this function, but we can't take a
* reference directly as we don't know the concrete type of the handle.
* GstMultiHandleSink relies on the derived class to take a reference for us
* in new_client: */
mhclient = mhsinkclass->new_client (mhsink, handle, sync_method);
/* we can add the handle now */

View file

@ -163,6 +163,7 @@ gst_tcp_server_sink_handle_server_read (GstTCPServerSink * sink)
goto accept_failed;
handle.socket = client_socket;
/* gst_multi_handle_sink_add does not take ownership of client_socket */
gst_multi_handle_sink_add (GST_MULTI_HANDLE_SINK (sink), handle);
#ifndef GST_DISABLE_GST_DEBUG
@ -177,9 +178,11 @@ gst_tcp_server_sink_handle_server_read (GstTCPServerSink * sink)
ip, g_inet_socket_address_get_port (addr), client_socket);
g_free (ip);
g_object_unref (addr);
}
#endif
g_object_unref (client_socket);
return TRUE;
/* ERRORS */