From 75cf21d83462d86702f71cecdb42eb16d3cc0f56 Mon Sep 17 00:00:00 2001 From: Doug Nazar Date: Wed, 21 May 2025 10:01:24 -0400 Subject: [PATCH] gstreamer: A few small memory cleanups Part-of: --- subprojects/gst-libav/ext/libav/gstavcfg.c | 1 + subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c | 2 ++ .../gst-plugins-good/ext/adaptivedemux2/dash/gstdashdemux.c | 5 +++-- subprojects/gstreamer/gst/gstdebugutils.c | 3 +-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-libav/ext/libav/gstavcfg.c b/subprojects/gst-libav/ext/libav/gstavcfg.c index 6092b086c4..369ace6c29 100644 --- a/subprojects/gst-libav/ext/libav/gstavcfg.c +++ b/subprojects/gst-libav/ext/libav/gstavcfg.c @@ -623,6 +623,7 @@ gst_ffmpeg_cfg_get_property (AVCodecContext * refcontext, GValue * value, if ((res = av_opt_get (refcontext, opt->name, AV_OPT_SEARCH_CHILDREN | AV_OPT_ALLOW_NULL, &val) >= 0)) { g_value_set_string (value, (gchar *) val); + av_free (val); } break; } diff --git a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c index 7fd0fdd895..f3e2e88452 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c +++ b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c @@ -4549,6 +4549,8 @@ db_output_stream_free (DecodebinOutputStream * output) if (output->src_exposed) { gst_element_remove_pad ((GstElement *) dbin, output->src_pad); + } else { + gst_clear_object (&output->src_pad); } g_free (output); } diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/dash/gstdashdemux.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/dash/gstdashdemux.c index 49fd05bbe8..beaeb51eee 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/dash/gstdashdemux.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/dash/gstdashdemux.c @@ -952,13 +952,14 @@ gst_dash_demux_setup_all_streams (GstDashDemux2 * demux) } else { /* Create the track this stream provides */ track = gst_adaptive_demux_track_new (GST_ADAPTIVE_DEMUX_CAST (demux), - streamtype, GST_STREAM_FLAG_NONE, stream_id, codec_caps, tags); + streamtype, GST_STREAM_FLAG_NONE, stream_id, codec_caps, + tags ? gst_tag_list_ref (tags) : NULL); } g_free (stream_id); if (tags) gst_adaptive_demux2_stream_set_tags (GST_ADAPTIVE_DEMUX2_STREAM_CAST - (stream), gst_tag_list_ref (tags)); + (stream), g_steal_pointer (&tags)); gst_adaptive_demux2_add_stream (GST_ADAPTIVE_DEMUX_CAST (demux), GST_ADAPTIVE_DEMUX2_STREAM_CAST (stream)); diff --git a/subprojects/gstreamer/gst/gstdebugutils.c b/subprojects/gstreamer/gst/gstdebugutils.c index 3e31cc7329..e68992764b 100644 --- a/subprojects/gstreamer/gst/gstdebugutils.c +++ b/subprojects/gstreamer/gst/gstdebugutils.c @@ -790,10 +790,9 @@ debug_dump_get_tracers_info (GstDebugGraphDetails details) /* Make sure each tracer line ends with \l even if it has no properties */ g_string_append (str, "\\l"); - } - g_list_free (tracers); + g_list_free_full (tracers, gst_object_unref); return g_string_free (str, FALSE); }