From 70cefdd2721729c786a1cb57f0ed9f6497eb027a Mon Sep 17 00:00:00 2001 From: He Junyan Date: Tue, 27 Aug 2019 18:12:45 +0800 Subject: [PATCH] libs: postproc: fix a memory leak point. filter_ops and filter_formats should already have valid value when the function gst_vaapipostproc_ensure_filter_caps re-enter --- gst/vaapi/gstvaapipostproc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index b852e8905a..b1750d0e50 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -246,13 +246,17 @@ gst_vaapipostproc_ensure_filter_caps (GstVaapiPostproc * postproc) if (!gst_vaapipostproc_ensure_filter (postproc)) return FALSE; - postproc->filter_ops = gst_vaapi_filter_get_operations (postproc->filter); - if (!postproc->filter_ops) - return FALSE; + if (!postproc->filter_ops) { + postproc->filter_ops = gst_vaapi_filter_get_operations (postproc->filter); + if (!postproc->filter_ops) + return FALSE; + } - postproc->filter_formats = gst_vaapi_filter_get_formats (postproc->filter); - if (!postproc->filter_formats) - return FALSE; + if (!postproc->filter_formats) { + postproc->filter_formats = gst_vaapi_filter_get_formats (postproc->filter); + if (!postproc->filter_formats) + return FALSE; + } return TRUE; }