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 <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit a0ec9185eb)

Conflicts:

	src/glx/dri_glx.c
This commit is contained in:
Brian Paul 2013-02-11 11:57:34 -07:00 committed by Andreas Boll
parent 527b3b8555
commit 5fdc42fb87

View file

@ -865,7 +865,6 @@ driCreateScreen(int screen, struct glx_display *priv)
}
psc->driver = driOpenDriver(driverName);
Xfree(driverName);
if (psc->driver == NULL)
goto cleanup;
@ -913,11 +912,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);