From 6c7dabb1e7e5b1435c8e4bcb082b6e7615454922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 2 May 2024 00:37:28 +0200 Subject: [PATCH] gst: fix stream params memory leak Both the GPtrArray and its contents are leaked in case of success. `pw_stream_connect()` copies the params as needed, so use `g_autoptr()` to free the array and with it, its contents. --- src/gst/gstpipewiresink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c index 3ce1092d1..8a6541615 100644 --- a/src/gst/gstpipewiresink.c +++ b/src/gst/gstpipewiresink.c @@ -563,7 +563,7 @@ static gboolean gst_pipewire_sink_setcaps (GstBaseSink * bsink, GstCaps * caps) { GstPipeWireSink *pwsink; - GPtrArray *possible; + g_autoptr(GPtrArray) possible = NULL; enum pw_stream_state state; const char *error = NULL; gboolean res = FALSE; @@ -658,7 +658,6 @@ start_error: { GST_ERROR ("could not start stream: %s", error); pw_thread_loop_unlock (pwsink->core->loop); - g_ptr_array_unref (possible); return FALSE; } }