summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2010-10-14 16:42:38 +0100
committerDave Airlie <[email protected]>2010-10-15 08:33:00 +1000
commitcbf2fb55432b8239ea9792338ee1d2fea89648ea (patch)
tree47e4084012bfd91f8e2de849125461109d022e27 /src/gallium
parent4bab22bca36696a7a1ed6ea3de9b993ffd181f30 (diff)
r600/drm: fix segfaults in winsys create failure path
Would try to destroy radeon->cman, radeon->kman both which were still NULL. Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/winsys/r600/drm/r600_drm.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c
index 5f175a4df98..4916843fd6d 100644
--- a/src/gallium/winsys/r600/drm/r600_drm.c
+++ b/src/gallium/winsys/r600/drm/r600_drm.c
@@ -179,9 +179,15 @@ struct radeon *radeon_decref(struct radeon *radeon)
return NULL;
}
- radeon->cman->destroy(radeon->cman);
- radeon->kman->destroy(radeon->kman);
- drmClose(radeon->fd);
+ if (radeon->cman)
+ radeon->cman->destroy(radeon->cman);
+
+ if (radeon->kman)
+ radeon->kman->destroy(radeon->kman);
+
+ if (radeon->fd >= 0)
+ drmClose(radeon->fd);
+
free(radeon);
return NULL;
}