From 5c913aaa794b0ca14785e85fdf4d2409a2f5b8a7 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sun, 7 Sep 2014 23:35:30 -0700 Subject: fix memleaks --- rtmp/rtmpconnection.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rtmp/rtmpconnection.c b/rtmp/rtmpconnection.c index 725e430..ffb85d7 100644 --- a/rtmp/rtmpconnection.c +++ b/rtmp/rtmpconnection.c @@ -850,7 +850,6 @@ gst_rtmp_connection_client_handshake1 (GstRtmpConnection * sc) g_output_stream_write_async (os, data, 1 + 1536, G_PRIORITY_DEFAULT, sc->cancellable, gst_rtmp_connection_client_handshake1_done, sc); - g_bytes_unref (bytes); } static void @@ -892,12 +891,11 @@ gst_rtmp_connection_client_handshake2 (GstRtmpConnection * sc) out_bytes = g_bytes_new_from_bytes (bytes, 1 + 1536, 1536); g_bytes_unref (bytes); - sc->output_bytes = bytes; - data = g_bytes_get_data (bytes, &size); + sc->output_bytes = out_bytes; + data = g_bytes_get_data (out_bytes, &size); os = g_io_stream_get_output_stream (G_IO_STREAM (sc->connection)); g_output_stream_write_async (os, data, size, G_PRIORITY_DEFAULT, sc->cancellable, gst_rtmp_connection_client_handshake2_done, sc); - g_bytes_unref (out_bytes); } static void @@ -919,6 +917,9 @@ gst_rtmp_connection_client_handshake2_done (GObject * obj, } GST_DEBUG ("wrote %" G_GSSIZE_FORMAT " bytes", ret); + g_bytes_unref (sc->output_bytes); + sc->output_bytes = NULL; + /* handshake finished */ GST_INFO ("client handshake finished"); sc->handshake_complete = TRUE; -- cgit v1.2.3