From 49eba42e081aba1f4361ec6b3de47bdd139ebfec Mon Sep 17 00:00:00 2001 From: Michael Gruner Date: Thu, 20 Jan 2022 17:13:36 -0600 Subject: [PATCH] gst-rtsp-server: Fix leak in appsrc2 example In the need-data appsrc callback, a buffer is pulled from the appsink. This buffer is then copied so that metadata is writable. The copy is pushed to the appsrc but it doesn't take ownership of the buffer so we need to manually unref it. The original buffer is finally unreffed when the sample is freed. Part-of: --- subprojects/gst-rtsp-server/examples/test-appsrc2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects/gst-rtsp-server/examples/test-appsrc2.c b/subprojects/gst-rtsp-server/examples/test-appsrc2.c index da2513ae8f..7f947124b7 100644 --- a/subprojects/gst-rtsp-server/examples/test-appsrc2.c +++ b/subprojects/gst-rtsp-server/examples/test-appsrc2.c @@ -63,6 +63,7 @@ need_data (GstElement * appsrc, guint unused, MyContext * ctx) GST_BUFFER_PTS (buffer) = pts; GST_BUFFER_DTS (buffer) = dts; g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret); + gst_buffer_unref (buffer); } /* we don't need the appsink sample anymore */