From: Keith Whitwell Date: Thu, 14 Oct 2010 15:42:38 +0000 (+0100) Subject: r600/drm: fix segfaults in winsys create failure path X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cbf2fb55432b8239ea9792338ee1d2fea89648ea;p=mesa.git 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 --- 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; }