From c560ec47fbedd7ca38bbcbe512804a307009af9e Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Mon, 24 Oct 2022 12:21:47 -0500 Subject: [PATCH] webrtc: Fix double free in webrtc-recvonly-h264 demo The "message" signal does not transfer ownership of the GBytes passed to it so calling g_bytes_unref() on it is incorrect. Part-of: --- .../gst-examples/webrtc/sendonly/webrtc-recvonly-h264.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-examples/webrtc/sendonly/webrtc-recvonly-h264.c b/subprojects/gst-examples/webrtc/sendonly/webrtc-recvonly-h264.c index c5ff6c91f6..bac3a3a036 100644 --- a/subprojects/gst-examples/webrtc/sendonly/webrtc-recvonly-h264.c +++ b/subprojects/gst-examples/webrtc/sendonly/webrtc-recvonly-h264.c @@ -490,7 +490,7 @@ soup_websocket_message_cb (G_GNUC_UNUSED SoupWebsocketConnection * connection, SoupWebsocketDataType data_type, GBytes * message, gpointer user_data) { gsize size; - gchar *data; + const gchar *data; gchar *data_string; const gchar *type_string; JsonNode *root_json; @@ -502,14 +502,12 @@ soup_websocket_message_cb (G_GNUC_UNUSED SoupWebsocketConnection * connection, switch (data_type) { case SOUP_WEBSOCKET_DATA_BINARY: g_error ("Received unknown binary message, ignoring\n"); - g_bytes_unref (message); return; case SOUP_WEBSOCKET_DATA_TEXT: - data = g_bytes_unref_to_data (message, &size); + data = g_bytes_get_data (message, &size); /* Convert to NULL-terminated string */ data_string = g_strndup (data, size); - g_free (data); break; default: