summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-06-23 14:11:20 +0000
committerNicholas Clark <nick@ccl4.org>2005-06-23 14:11:20 +0000
commit94010e71b67db04027249ff69e2a2bfa9a050945 (patch)
tree3288295ac02b3ed67238e92114987299ead8ffc3 /pp_ctl.c
parent771ba71a7bf3673decf297992c8591f2ff873802 (diff)
downloadperl-94010e71b67db04027249ff69e2a2bfa9a050945.tar.gz
Add a define PERL_POISON which tries to trip up anything accessing
freed or uninitialised memory. Currently only Poison()s freed pointers. p4raw-id: //depot/perl@24959
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index b6c72e84cd..d39d3560f6 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -371,7 +371,14 @@ Perl_rxres_free(pTHX_ void **rsp)
UV *p = (UV*)*rsp;
if (p) {
+#ifdef PERL_POISON
+ void *tmp = INT2PTR(char*,*p);
+ Safefree(tmp);
+ if (*p)
+ Poison(*p, 1, sizeof(*p));
+#else
Safefree(INT2PTR(char*,*p));
+#endif
#ifdef PERL_OLD_COPY_ON_WRITE
if (p[1]) {
SvREFCNT_dec (INT2PTR(SV*,p[1]));