diff --git a/src/stralloc.c b/src/stralloc.c index 972138a4ba46c5607178cb8463eb3b208a421835..c03d444e97147023bcc15e38bb19e35ffe64ece4 100644 --- a/src/stralloc.c +++ b/src/stralloc.c @@ -15,7 +15,7 @@ #include <ctype.h> -RCSID("$Id: stralloc.c,v 1.31 1998/04/17 05:13:32 hubbe Exp $"); +RCSID("$Id: stralloc.c,v 1.32 1998/04/17 16:57:12 hubbe Exp $"); #define BEGIN_HASH_SIZE 997 #define MAX_AVG_LINK_LENGTH 3 @@ -193,6 +193,10 @@ static void rehash(void) struct pike_string *debug_begin_shared_string(int len) { struct pike_string *t; +#ifdef DEBUG + if(d_flag>10) + verify_shared_strings_tables(); +#endif t=(struct pike_string *)xalloc(len + sizeof(struct pike_string)); t->str[len]=0; t->len=len; @@ -278,6 +282,9 @@ void really_free_string(struct pike_string *s) { if(s->next == (struct pike_string *)-1) fatal("Freeing shared string again!\n"); + + if(((long)s->next) & 1) + fatal("Freeing shared string again, memory corrupt or other bug!\n"); unlink_pike_string(s); s->next=(struct pike_string *)-1;