From cbf2fb55432b8239ea9792338ee1d2fea89648ea Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 14 Oct 2010 16:42:38 +0100 Subject: 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 --- src/gallium/winsys/r600/drm/r600_drm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/gallium/winsys/r600') 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; } -- cgit v1.2.3