From bd4005713095393a9f8d201ce8483a55453312a0 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 14 Nov 2024 09:46:28 -0500 Subject: [PATCH] v4l2codecs: Fix caps string leak in v4l2codecs Unlike gst_video_format_to_string(), gst_video_dma_drm_fourcc_to_string() return a freshly allocated string which needs to be free. Part-of: --- .../gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c index 6777ee6bb6..66bb51f06a 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c @@ -468,10 +468,13 @@ gst_v4l2_decoder_probe_caps_for_format (GstV4l2Decoder * self, drm_fourcc = gst_video_dma_drm_fourcc_from_format_full (format, &modifier); if (drm_fourcc /* != DRM_FORMAT_INVALID */ ) { GstCaps *drm_caps; + gchar *drm_format_str = + gst_video_dma_drm_fourcc_to_string (drm_fourcc, modifier); drm_caps = gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING, - "DMA_DRM", "drm-format", G_TYPE_STRING, - gst_video_dma_drm_fourcc_to_string (drm_fourcc, modifier), NULL); + "DMA_DRM", "drm-format", G_TYPE_STRING, drm_format_str, NULL); + g_free (drm_format_str); + gst_caps_set_features_simple (drm_caps, gst_caps_features_new_single_static_str (GST_CAPS_FEATURE_MEMORY_DMABUF));