From: Dave Airlie Date: Fri, 30 Nov 2012 07:47:47 +0000 (+1000) Subject: dri_glx: fix use after free report X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a0ec9185eb90568ab57170dc682de0ba0c9e5e62;p=mesa.git dri_glx: fix use after free report the critical error would use driverName. Found by internal RH coverity scan. Note: This is a candidate for stable branches. Reviewed-by: Alex Deucher Signed-off-by: Dave Airlie --- diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c index de777fbba8b..f42db79ad61 100644 --- a/src/glx/dri_glx.c +++ b/src/glx/dri_glx.c @@ -805,7 +805,6 @@ driCreateScreen(int screen, struct glx_display *priv) } psc->driver = driOpenDriver(driverName); - free(driverName); if (psc->driver == NULL) goto cleanup; @@ -847,11 +846,15 @@ driCreateScreen(int screen, struct glx_display *priv) psp->setSwapInterval = driSetSwapInterval; psp->getSwapInterval = driGetSwapInterval; + free(driverName); + return &psc->base; cleanup: CriticalErrorMessageF("failed to load driver: %s\n", driverName); + free(driverName); + if (psc->driver) dlclose(psc->driver); glx_screen_cleanup(&psc->base);