summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPali <pali@cpan.org>2018-09-28 13:17:01 +0200
committerTony Cook <tony@develop-help.com>2018-10-29 15:32:23 +1100
commit5ace197f9a644bde21b1b41430099295ed92365e (patch)
treeddfbd08f84e84f4929757d0783d3545f8034da98
parent238fb9b3844424a58811fb7947219a2c016ee3b0 (diff)
downloadperl-5ace197f9a644bde21b1b41430099295ed92365e.tar.gz
Define also Perl's calloc() macro
Functions malloc(), realloc() and free() are already redefined to PerlMem_malloc(), PerlMem_realloc() and PerlMem_free(). But calloc() not. This leads to the problem that memory by calloc() is allocated by system C library, but freed by Perl's PerlMem_free() which just cause memory corruptions.
-rw-r--r--XSUB.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/XSUB.h b/XSUB.h
index f637c91867..796a13aae3 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -609,6 +609,7 @@ Rethrows a previously caught exception. See L<perlguts/"Exception Handling">.
# define utime PerlLIO_utime
# define write PerlLIO_write
# define malloc PerlMem_malloc
+# define calloc PerlMem_calloc
# define realloc PerlMem_realloc
# define free PerlMem_free
# define abort PerlProc_abort