summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorBoyan Ding <[email protected]>2015-08-08 17:23:28 +0800
committerEmil Velikov <[email protected]>2015-08-08 13:36:17 +0100
commit27141f984d6401dc466f0e9b0c5da2a9248045e3 (patch)
tree32395749a073e4bebb78619d7fd6ef944cea83b0 /src/egl
parenta1adf0b3fe428a4bf690f166c2697d8c7ea2dcb0 (diff)
egl/x11: Fix driver_name acquisition
We don't need to free driverName string from dri2 reply, on the other hand, the driver name acquired from loader doesn't need duplication. Fixes: 45e110bad9d (egl/x11: trust our loader over the xserver for the drivername) Reported-by: Timothy Arceri <[email protected]> Signed-off-by: Boyan Ding <[email protected]> [Emil Velikov: use brackets for both branches of conditional] Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/platform_x11.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 61e5b77ac78..9b040f7d491 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -602,14 +602,13 @@ dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
*/
loader_driver_name = loader_get_driver_for_fd(dri2_dpy->fd, 0);
if (loader_driver_name) {
- free(driver_name);
- driver_name = loader_driver_name;
+ dri2_dpy->driver_name = loader_driver_name;
+ } else {
+ dri2_dpy->driver_name =
+ strndup(driver_name,
+ xcb_dri2_connect_driver_name_length(connect));
}
- dri2_dpy->driver_name =
- strndup(driver_name,
- xcb_dri2_connect_driver_name_length(connect));
-
if (dri2_dpy->device_name == NULL || dri2_dpy->driver_name == NULL) {
close(dri2_dpy->fd);
free(dri2_dpy->device_name);