dri2: Fix memory leak.

Fix defect reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable psp going out of scope leaks the storage it points to.

Fixes: 68aa2099fa ("dri2: Require a loader with working buffer invalidation")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16680>
This commit is contained in:
Vinson Lee 2022-05-23 16:50:20 -07:00
parent 96d9093c19
commit b7e22864aa
1 changed files with 3 additions and 1 deletions

View File

@ -122,8 +122,10 @@ driCreateNewScreen2(int scrn, int fd,
setupLoaderExtensions(psp, extensions);
// dri2 drivers require working invalidate
if (fd != -1 && !psp->dri2.useInvalidate)
if (fd != -1 && !psp->dri2.useInvalidate) {
free(psp);
return NULL;
}
psp->loaderPrivate = data;