mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pipewire: assert a nonzero array allocation size
If pw_array_ensure_size() is called on an array that has not been initialized with an extend, assert. Otherwise we get stuck in an infinite loop since doubling our zero allocation size will never reach "need".
This commit is contained in:
parent
0ba9402d4b
commit
4cb87317a7
1 changed files with 1 additions and 0 deletions
|
|
@ -117,6 +117,7 @@ static inline int pw_array_ensure_size(struct pw_array *arr, size_t size)
|
|||
if (SPA_UNLIKELY(alloc < need)) {
|
||||
void *data;
|
||||
alloc = SPA_MAX(alloc, arr->extend);
|
||||
spa_assert(alloc != 0); /* forgot pw_array_init */
|
||||
while (alloc < need)
|
||||
alloc *= 2;
|
||||
if (SPA_UNLIKELY((data = realloc(arr->data, alloc)) == NULL))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue