diff options
author | Nicolai Hähnle <[email protected]> | 2019-05-13 16:58:07 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-06-12 18:30:25 -0400 |
commit | 71b45bae14be84ab09212c9ded758fa31e31e945 (patch) | |
tree | f880ff775e446ebe07dcb1900492dedc670c8245 /src/gallium/drivers/nouveau/nv30 | |
parent | dc753625115844b0813f632340ab7e0dbb3c0fb2 (diff) |
u_dynarray: return 0 on realloc failure and ensure no-op
We're not very good at handling out-of-memory conditions in general, but
this change at least gives the caller the option of handling it gracefully
and without memory leaks.
This happens to fix an error in out-of-memory handling in i965, which has
the following code in brw_bufmgr.c:
node = util_dynarray_grow(vma_list, sizeof(struct vma_bucket_node));
if (unlikely(!node))
return 0ull;
Previously, allocation failure for util_dynarray_grow wouldn't actually
return NULL when the dynarray was previously non-empty.
v2:
- make util_dynarray_ensure_cap a no-op on failure, add MUST_CHECK attribute
- simplify the new capacity calculation: aside from avoiding a useless loop
when newcap is very large, this also avoids an infinite loop when newcap
is larger than 1 << 31
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/nv30')
0 files changed, 0 insertions, 0 deletions