mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-02-05 04:06:20 -05:00
Merge branch 'array-add-assert' into 'main'
util: assert alloc is consistent with data in wl_array_add() See merge request wayland/wayland!515
This commit is contained in:
commit
69ebccd65b
1 changed files with 3 additions and 0 deletions
|
|
@ -24,6 +24,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
|
@ -121,6 +122,8 @@ wl_array_add(struct wl_array *array, size_t size)
|
|||
alloc *= 2;
|
||||
|
||||
if (array->alloc < alloc) {
|
||||
assert(array->alloc > 0 || array->data == NULL);
|
||||
|
||||
if (array->alloc > 0)
|
||||
data = realloc(array->data, alloc);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue