From 6bb294343bba51d5cbb28e0edbc8a7ab99709907 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Fri, 6 Sep 2024 23:44:53 +0800 Subject: [PATCH] va: jpegenc: Fix a memory leak when filter sink caps Part-of: --- subprojects/gst-plugins-bad/sys/va/gstvajpegenc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvajpegenc.c b/subprojects/gst-plugins-bad/sys/va/gstvajpegenc.c index 9b22b887b0..3850a8cc52 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvajpegenc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvajpegenc.c @@ -1216,8 +1216,10 @@ _filter_sink_caps (GstCaps * sinkcaps) guint32 fourcc; val = gst_structure_get_value (st, "drm-format"); - if (!val) + if (!val) { + gst_structure_free (st); continue; + } if (G_VALUE_HOLDS_STRING (val)) { format_str = g_value_get_string (val); @@ -1253,8 +1255,10 @@ _filter_sink_caps (GstCaps * sinkcaps) gst_caps_features_copy (features)); } else { val = gst_structure_get_value (st, "format"); - if (!val) + if (!val) { + gst_structure_free (st); continue; + } if (G_VALUE_HOLDS_STRING (val)) { format_str = g_value_get_string (val); @@ -1299,7 +1303,6 @@ _filter_sink_caps (GstCaps * sinkcaps) return ret; } - gboolean gst_va_jpeg_enc_register (GstPlugin * plugin, GstVaDevice * device, GstCaps * sink_caps, GstCaps * src_caps, guint rank,