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

+8
View File
@@ -1,6 +1,10 @@
# Tests are groups of three lines: program, input, expected output
# Blank lines and lines starting with # are ignored
@base64
""
""
@base64
"<>&'\"\t"
"PD4mJyIJ"
@@ -15,6 +19,10 @@
"foóbar\n"
"Zm/Ds2Jhcgo="
@base64d
""
""
@base64d
"Zm/Ds2Jhcgo="
"foóbar\n"