mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 04:05:34 +00:00
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3257>
This commit is contained in:
parent
e25a6f4794
commit
2a59e8af97
1 changed files with 2 additions and 4 deletions
|
@ -490,7 +490,7 @@ soup_websocket_message_cb (G_GNUC_UNUSED SoupWebsocketConnection * connection,
|
||||||
SoupWebsocketDataType data_type, GBytes * message, gpointer user_data)
|
SoupWebsocketDataType data_type, GBytes * message, gpointer user_data)
|
||||||
{
|
{
|
||||||
gsize size;
|
gsize size;
|
||||||
gchar *data;
|
const gchar *data;
|
||||||
gchar *data_string;
|
gchar *data_string;
|
||||||
const gchar *type_string;
|
const gchar *type_string;
|
||||||
JsonNode *root_json;
|
JsonNode *root_json;
|
||||||
|
@ -502,14 +502,12 @@ soup_websocket_message_cb (G_GNUC_UNUSED SoupWebsocketConnection * connection,
|
||||||
switch (data_type) {
|
switch (data_type) {
|
||||||
case SOUP_WEBSOCKET_DATA_BINARY:
|
case SOUP_WEBSOCKET_DATA_BINARY:
|
||||||
g_error ("Received unknown binary message, ignoring\n");
|
g_error ("Received unknown binary message, ignoring\n");
|
||||||
g_bytes_unref (message);
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SOUP_WEBSOCKET_DATA_TEXT:
|
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 */
|
/* Convert to NULL-terminated string */
|
||||||
data_string = g_strndup (data, size);
|
data_string = g_strndup (data, size);
|
||||||
g_free (data);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue