[Mesa-dev] [PATCH 1/3] r600/drm: fix segfaults in winsys create failure path
Keith Whitwell
keithw at vmware.com
Thu Oct 14 08:42:38 PDT 2010
Would try to destroy radeon->cman, radeon->kman both which were still
NULL.
---
src/gallium/winsys/r600/drm/r600_drm.c | 12 +++++++++---
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 5f175a4..4916843 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;
}
--
1.7.1
More information about the mesa-dev
mailing list