egl: android: Fix potential use of unitialized variable
authorTomasz Figa <tfiga@chromium.org>
Wed, 5 Jul 2017 14:56:51 +0000 (23:56 +0900)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 5 Jul 2017 17:49:22 +0000 (18:49 +0100)
If dri2_setup_extensions() fails, the "err" variable would not be assigned
causing the error path to access an unitialized variable. Fix it by
assigning an error message.

Fixes: 2c341f2bda4 ("egl: refactor dri2_create_screen() into three separate functions")
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/egl/drivers/dri2/platform_android.c

index 3be69d87ffa6d8dc5bd9677d9e9b917f2182af7f..13006fee873a0a590aedb841a7a0dea1677f96a2 100644 (file)
@@ -1214,8 +1214,10 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)
       goto cleanup;
    }
 
-   if (!dri2_setup_extensions(dpy))
+   if (!dri2_setup_extensions(dpy)) {
+      err = "DRI2: failed to setup extensions";
       goto cleanup;
+   }
 
    dri2_setup_screen(dpy);