dri: Free the already allocated optionCache and optionInfo on failure

These fields are allocated as they have to be taken into account for initScreen.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20663>
This commit is contained in:
Corentin Noël
2023-01-12 10:35:21 +01:00
committed by Marge Bot
parent 7e61696de9
commit bee771412c

View File

@@ -138,6 +138,8 @@ driCreateNewScreen2(int scrn, int fd,
*driver_configs = mesa->initScreen(screen);
if (*driver_configs == NULL) {
driDestroyOptionCache(&screen->optionCache);
driDestroyOptionInfo(&screen->optionInfo);
free(screen);
return NULL;
}