From 931387e9c1abdc84b5eb5ce9018e5f534a5b6ed1 Mon Sep 17 00:00:00 2001 From: Carl Zhang Date: Sun, 17 Sep 2023 23:07:48 -0400 Subject: [PATCH] va: fix the fd leak issue caused by vaInitialize failure Signed-off-by: Carl Zhang --- va/va.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/va/va.c b/va/va.c index 920b76c50..baf412346 100644 --- a/va/va.c +++ b/va/va.c @@ -742,6 +742,11 @@ VAStatus vaInitialize( vaStatus = va_new_opendriver(dpy); + if (VA_STATUS_SUCCESS != vaStatus) { + VADisplayContextP pDisplayContext = (VADisplayContextP)dpy; + pDisplayContext->vaDestroy(pDisplayContext); + } + *major_version = VA_MAJOR_VERSION; *minor_version = VA_MINOR_VERSION;