From 77589878c1d58e368d3d69b245c9bb3042c0fd02 Mon Sep 17 00:00:00 2001 From: Timerix Date: Thu, 13 Nov 2025 00:37:59 +0500 Subject: [PATCH] added check for zero size in Array_alloc --- include/tlibc/collections/Array.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/tlibc/collections/Array.h b/include/tlibc/collections/Array.h index 5b72572..1421ca0 100755 --- a/include/tlibc/collections/Array.h +++ b/include/tlibc/collections/Array.h @@ -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))