diff --git a/gst/tcp/gstmultihandlesink.c b/gst/tcp/gstmultihandlesink.c index b9ba36b39b..aa1cfb2997 100644 --- a/gst/tcp/gstmultihandlesink.c +++ b/gst/tcp/gstmultihandlesink.c @@ -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 */ diff --git a/gst/tcp/gsttcpserversink.c b/gst/tcp/gsttcpserversink.c index 244b5764fe..b805ebc40f 100644 --- a/gst/tcp/gsttcpserversink.c +++ b/gst/tcp/gsttcpserversink.c @@ -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 */