mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 19:40:10 +01:00
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 44a4abfd4f)
This commit is contained in:
parent
a70c45bdab
commit
e15aebe10e
1 changed files with 7 additions and 0 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue