From c98f5c2bf43d346df0ef27940ca8e4c384c34d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Mon, 19 Jun 2023 14:25:09 +0200 Subject: [PATCH] vkvideoutils: fix memory leak in structure's string Retrieve a const char* from structure for "chromat-format" and avoid extra mem copy. Part-of: --- .../gst-libs/gst/vulkan/gstvkvideoutils.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideoutils.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideoutils.c index 26a4c52f3b..12791edf68 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideoutils.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideoutils.c @@ -282,10 +282,11 @@ gst_vulkan_video_profile_from_caps (GstVulkanVideoProfile * profile, } if (i == G_N_ELEMENTS (video_codecs_map)) return FALSE; - - if (!gst_structure_get (structure, "chroma-format", G_TYPE_STRING, - &chroma_sub, "bit-depth-luma", G_TYPE_UINT, &luma, "bit-depth-chroma", - G_TYPE_UINT, &chroma, NULL)) + chroma_sub = gst_structure_get_string (structure, "chroma-format"); + if (!chroma_sub) + return FALSE; + if (!gst_structure_get (structure, "bit-depth-luma", G_TYPE_UINT, &luma, + "bit-depth-chroma", G_TYPE_UINT, &chroma, NULL)) return FALSE; for (i = 0; i < G_N_ELEMENTS (video_chroma_map); i++) {