summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-09-13 11:06:17 -0400
committerIlia Mirkin <[email protected]>2014-09-13 11:17:26 -0400
commit2e86432cc1bda7ff4f196083455baf1fb9eae40c (patch)
tree2b9882977c22ada6d45aee368c20936f712e42a5
parentb13a4ca3f7f622cbf688eec14d3f4156533af44e (diff)
nouveau: avoid leaking screen on initialization fail
Reported by Coverity Signed-off-by: Ilia Mirkin <[email protected]>
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_screen.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 766ae6f2f79..150dd8e9209 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -95,6 +95,8 @@ nouveau_init_screen2(__DRIscreen *dri_screen)
if (!screen)
return NULL;
+ dri_screen->driverPrivate = screen;
+
/* Open the DRM device. */
ret = nouveau_device_wrap(dri_screen->fd, 0, &screen->device);
if (ret) {
@@ -119,10 +121,11 @@ nouveau_init_screen2(__DRIscreen *dri_screen)
dri_screen->max_gl_es1_version = 10;
break;
default:
- assert(0);
+ nouveau_error("Unknown chipset: %02X\n",
+ screen->device->chipset);
+ goto fail;
}
- dri_screen->driverPrivate = screen;
dri_screen->extensions = nouveau_screen_extensions;
screen->dri_screen = dri_screen;