Avoid zero-length calloc (#3280)

Using `calloc` function with a count of zero elements is implementation
defined and it may cause allocation errors on some platforms (ref #3277).
This commit fixes `jv_mem_calloc` callers to avoid undefined behavior.
This commit is contained in:
itchyny authored and GitHub committed 2025-03-04 22:33:51 +09:00
1 parent 4003202ccf
commit a8ce2ff09a
6 files changed
+28 -7

No files matched your search

-1
View File
@@ -2,7 +2,6 @@
#define JV_ALLOC_H
#include <stddef.h>
#include "jv.h"
void* jv_mem_alloc(size_t);
void* jv_mem_alloc_unguarded(size_t);