Mesa (mesa_7_5_branch): i965: fix segfault on low memory conditions
Ian Romanick
idr at kemper.freedesktop.org
Wed Jun 17 20:32:40 UTC 2009
Module: Mesa
Branch: mesa_7_5_branch
Commit: e15aebe10e20aacce63175b68ec8daa5c1dc4e0c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e15aebe10e20aacce63175b68ec8daa5c1dc4e0c
Author: Robert Ellison <papillo at vmware.com>
Date: Fri May 8 14:40:38 2009 -0600
i965: fix segfault on low memory conditions
When out of memory (in at least one case, triggered by a longrunning
memory leak), this code will segfault and crash. By checking for the
out-of-memory condition, the system can continue, and will report
the out-of-memory error later, a much preferable outcome.
(cherry picked from commit 44a4abfd4f8695809eaec07df8eeb191d6e017d7)
---
src/mesa/drivers/dri/i965/brw_wm.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index bd296aa..8a3b7df 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -146,6 +146,13 @@ static void do_wm_prog( struct brw_context *brw,
if (c == NULL) {
brw->wm.compile_data = calloc(1, sizeof(*brw->wm.compile_data));
c = brw->wm.compile_data;
+ if (c == NULL) {
+ /* Ouch - big out of memory problem. Can't continue
+ * without triggering a segfault, no way to signal,
+ * so just return.
+ */
+ return;
+ }
} else {
memset(c, 0, sizeof(*brw->wm.compile_data));
}
More information about the mesa-commit
mailing list