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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7849>
This commit is contained in:
Nicolas Dufresne 2024-11-14 09:46:28 -05:00 committed by GStreamer Marge Bot
parent 61d2231c58
commit bd40057130

View file

@ -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); drm_fourcc = gst_video_dma_drm_fourcc_from_format_full (format, &modifier);
if (drm_fourcc /* != DRM_FORMAT_INVALID */ ) { if (drm_fourcc /* != DRM_FORMAT_INVALID */ ) {
GstCaps *drm_caps; 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, drm_caps = gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING,
"DMA_DRM", "drm-format", G_TYPE_STRING, "DMA_DRM", "drm-format", G_TYPE_STRING, drm_format_str, NULL);
gst_video_dma_drm_fourcc_to_string (drm_fourcc, modifier), NULL); g_free (drm_format_str);
gst_caps_set_features_simple (drm_caps, gst_caps_set_features_simple (drm_caps,
gst_caps_features_new_single_static_str gst_caps_features_new_single_static_str
(GST_CAPS_FEATURE_MEMORY_DMABUF)); (GST_CAPS_FEATURE_MEMORY_DMABUF));