summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorLarry Wall <lwall@jpl-devvax.jpl.nasa.gov>1989-11-10 16:20:25 +0000
committerLarry Wall <lwall@jpl-devvax.jpl.nasa.gov>1989-11-10 16:20:25 +0000
commitbf38876a182e0df9dd73362f56cf0ab8b43aa789 (patch)
tree0c8c37dbaeeadb7549ca7b6d3f2b19d92896f9bb /malloc.c
parent91407755d9b894ac1239c4fafe586e52138db38d (diff)
downloadperl-bf38876a182e0df9dd73362f56cf0ab8b43aa789.tar.gz
perl 3.0 patch #3 Patch #2 continued
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/malloc.c b/malloc.c
index 4318a2cec7..ee926f65d4 100644
--- a/malloc.c
+++ b/malloc.c
@@ -1,6 +1,9 @@
-/* $Header: malloc.c,v 3.0.1.1 89/10/26 23:15:05 lwall Locked $
+/* $Header: malloc.c,v 3.0.1.2 89/11/11 04:36:37 lwall Locked $
*
* $Log: malloc.c,v $
+ * Revision 3.0.1.2 89/11/11 04:36:37 lwall
+ * patch2: malloc pointer corruption check made more portable
+ *
* Revision 3.0.1.1 89/10/26 23:15:05 lwall
* patch1: some declarations were missing from malloc.c
* patch1: sparc machines had alignment problems in malloc.c
@@ -137,13 +140,15 @@ malloc(nbytes)
if ((p = (union overhead *)nextf[bucket]) == NULL)
return (NULL);
/* remove from linked list */
- if (*((int*)p) > 0x10000000)
+#ifdef RCHECK
+ if (*((int*)p) & (sizeof(union overhead) - 1))
#ifndef I286
fprintf(stderr,"Corrupt malloc ptr 0x%x at 0x%x\n",*((int*)p),p);
#else
fprintf(stderr,"Corrupt malloc ptr 0x%lx at 0x%lx\n",*((int*)p),p);
#endif
- nextf[bucket] = nextf[bucket]->ov_next;
+#endif
+ nextf[bucket] = p->ov_next;
p->ov_magic = MAGIC;
p->ov_index= bucket;
#ifdef MSTATS