summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2011-05-12 15:23:02 +0100
committerJosé Fonseca <jfonseca@vmware.com>2011-05-12 15:23:02 +0100
commit6c26072bd151ee7abc897aad63cd55ec5f15762e (patch)
treee78eec86ed55205e484a9f29ea7a49a84fd73d3e /src/egl
parent6a661895e946f38b21775bf9cb45ef6b22fab85a (diff)
egl/dri2: Fix const pointer duplication, prevent unitialized variable dereference.
Based on zhigang gong <zhigang.gong@gmail.com>'s patch.
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/platform_drm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 261cbfed675..9811b280299 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -581,7 +581,8 @@ dri2_get_device_name(int fd)
struct udev *udev;
struct udev_device *device;
struct stat buf;
- char *device_name;
+ const char *const_device_name;
+ char *device_name = NULL;
udev = udev_new();
if (fstat(fd, &buf) < 0) {
@@ -596,10 +597,11 @@ dri2_get_device_name(int fd)
goto out;
}
- device_name = udev_device_get_devnode(device);
- if (!device_name)
- goto out;
- device_name = strdup(device_name);
+ const_device_name = udev_device_get_devnode(device);
+ if (!const_device_name) {
+ goto out;
+ }
+ device_name = strdup(const_device_name);
out:
udev_device_unref(device);