summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2014-09-07 23:35:30 -0700
committerDavid Schleef <ds@schleef.org>2014-09-07 23:35:30 -0700
commit5c913aaa794b0ca14785e85fdf4d2409a2f5b8a7 (patch)
tree2d403a43fbedc8485ebdc59aa5af959b613317b1
parent4dbcf7886717bd49ca9acdc7fe4589e3114c4326 (diff)
fix memleaks
-rw-r--r--rtmp/rtmpconnection.c9
1 files 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;