Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

va: fix the fd leak issue caused by vaInitialize failure #753

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions va/va.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,11 @@ VAStatus vaInitialize(

vaStatus = va_new_opendriver(dpy);

if (VA_STATUS_SUCCESS != vaStatus) {
VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
pDisplayContext->vaDestroy(pDisplayContext);
Copy link
Contributor

@evelikov evelikov Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is a good idea for a few of reasons:

  • on error we should not be touching out variables
  • on error we're leaking the state setup via va_TraceInit - pre-existing issue
  • as-is on vaInitialize() failure, state set in vaGetDisplay*() will be removed, which is fairly assummetrical and off IMHO

}

*major_version = VA_MAJOR_VERSION;
*minor_version = VA_MINOR_VERSION;

Expand Down