Thu, 28 Nov 2024 19:37:00 +0100
fix cx_array_advanced_realloc to handle reallocation of NULL arrays, consistent with standard realloc behavior
src/array_list.c | file | annotate | diff | comparison | revisions |
--- a/src/array_list.c Wed Nov 27 22:33:30 2024 +0100 +++ b/src/array_list.c Thu Nov 28 19:37:00 2024 +0100 @@ -63,7 +63,7 @@ void *newmem; if (array == alloc->ptr2) { newmem = cxMalloc(al, capacity * elem_size); - if (newmem != NULL) { + if (newmem != NULL && array != NULL) { memcpy(newmem, array, capacity * elem_size); } } else {