summaryrefslogtreecommitdiff
path: root/src/glx
diff options
context:
space:
mode:
authorDave Airlie <airlied@gmail.com>2012-11-30 17:47:47 +1000
committerDave Airlie <airlied@gmail.com>2012-12-01 11:20:36 +1000
commita0ec9185eb90568ab57170dc682de0ba0c9e5e62 (patch)
treef92b4ccfb88615cb8300246087baf5b3642fefca /src/glx
parenta47a0200a78ed8bddcf0c79b4b630e475e7357ca (diff)
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>
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/dri_glx.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index de777fbba8..f42db79ad6 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);