From c9e093d499d2c062171357ad322f9338a11ed060 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Mon, 31 Mar 2025 12:53:37 +0100 Subject: [PATCH] check-va-api: Free arrays of formats and attributes automatically Signed-off-by: Simon McVittie <smcv@collabora.com> --- helpers/check-va-api.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/helpers/check-va-api.c b/helpers/check-va-api.c index 51d65970..8dadceaa 100644 --- a/helpers/check-va-api.c +++ b/helpers/check-va-api.c @@ -204,9 +204,9 @@ create_surfaces (VADisplay va_display, VAImage img; VAImageFormat image_format; unsigned int num_attribs; - VASurfaceAttrib *attrib_list = NULL; + autofree VASurfaceAttrib *attrib_list = NULL; int num_formats; - VAImageFormat *format_list = NULL; + autofree VAImageFormat *format_list = NULL; bool ret = false; #define do_vaapi_or_exit(expr) if (! _do_vaapi (#expr, expr)) goto out; @@ -288,8 +288,6 @@ create_surfaces (VADisplay va_display, ret = true; out: - free (attrib_list); - free (format_list); if (img.image_id != VA_INVALID_ID) vaDestroyImage (va_display, img.image_id); -- GitLab