added check for zero size in Array_alloc
This commit is contained in:
parent
3034e4d186
commit
77589878c1
@ -17,7 +17,7 @@ typedef struct Array_ {
|
||||
#define Array_alloc(T, COUNT) Array_alloc_size((COUNT) * sizeof(T))
|
||||
|
||||
static inline Array_ Array_alloc_size(u32 size){
|
||||
return Array_construct_size(malloc(size), size);
|
||||
return Array_construct_size(size > 0 ? malloc(size) : NULL, size);
|
||||
}
|
||||
|
||||
#define Array_realloc(SELF, T, COUNT) Array_realloc_size(SELF, (COUNT) * sizeof(T))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user