diff --git a/src/array.c b/src/array.c index ccfbf4c355eede6ee2445103dc8e4e8c2746fd6a..dd69f7c72f1848bbee41853be92e1a5a04714838 100644 --- a/src/array.c +++ b/src/array.c @@ -23,7 +23,7 @@ #include "stuff.h" #include "bignum.h" -RCSID("$Id: array.c,v 1.74 2000/07/04 00:43:56 mast Exp $"); +RCSID("$Id: array.c,v 1.75 2000/07/06 23:25:25 mast Exp $"); struct array empty_array= { @@ -129,7 +129,8 @@ void really_free_array(struct array *v) void do_free_array(struct array *a) { - free_array(a); + if (a) + free_array(a); } /* diff --git a/src/mapping.c b/src/mapping.c index ce79e7a21352cba54b656a7b7bed2e64156c6c69..b43d44273de883c596655d6d21ec847702817124 100644 --- a/src/mapping.c +++ b/src/mapping.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: mapping.c,v 1.90 2000/07/04 00:43:57 mast Exp $"); +RCSID("$Id: mapping.c,v 1.91 2000/07/06 23:25:26 mast Exp $"); #include "main.h" #include "object.h" #include "mapping.h" @@ -210,6 +210,12 @@ void really_free_mapping_data(struct mapping_data *md) free((char *) md); } +void do_free_mapping(struct mapping *m) +{ + if (m) + free_mapping(m); +} + /* This function is used to rehash a mapping without loosing the internal * order in each hash chain. This is to prevent mappings from becoming * inefficient just after being rehashed. diff --git a/src/mapping.h b/src/mapping.h index 0959bf2016b8d936611abf4df9122092e5981df0..0bd51726ba47c19057af9cb98f3e09f0d8f1d6b0 100644 --- a/src/mapping.h +++ b/src/mapping.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: mapping.h,v 1.25 2000/06/09 22:43:05 mast Exp $ + * $Id: mapping.h,v 1.26 2000/07/06 23:25:26 mast Exp $ */ #ifndef MAPPING_H #define MAPPING_H @@ -80,6 +80,7 @@ BLOCK_ALLOC(mapping, 511) struct mapping *debug_allocate_mapping(int size); void really_free_mapping_data(struct mapping_data *md); +void do_free_mapping(struct mapping *m); struct mapping_data *copy_mapping_data(struct mapping_data *md); void mapping_fix_type_field(struct mapping *m); void low_mapping_insert(struct mapping *m, diff --git a/src/multiset.c b/src/multiset.c index 8722c1cb8f32fc5262c577d20e2da742a10559a2..98bc4392a9d9cb47a00d29e80bcdb1a5e86e8bf8 100644 --- a/src/multiset.c +++ b/src/multiset.c @@ -16,7 +16,7 @@ #include "gc.h" #include "security.h" -RCSID("$Id: multiset.c,v 1.22 2000/06/09 22:43:04 mast Exp $"); +RCSID("$Id: multiset.c,v 1.23 2000/07/06 23:25:26 mast Exp $"); struct multiset *first_multiset; @@ -70,6 +70,12 @@ void really_free_multiset(struct multiset *l) GC_FREE(); } +void do_free_multiset(struct multiset *l) +{ + if (l) + free_multiset(l); +} + void order_multiset(struct multiset *l) { diff --git a/src/multiset.h b/src/multiset.h index cb34d87225fb1ebf60ad7ae9daade11d5cb4cb0a..85bb71b1a62d30a5fb5456bb26dc7bfeef402652 100644 --- a/src/multiset.h +++ b/src/multiset.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: multiset.h,v 1.11 2000/06/09 22:43:04 mast Exp $ + * $Id: multiset.h,v 1.12 2000/07/06 23:25:26 mast Exp $ */ #ifndef MULTISET_H #define MULTISET_H @@ -33,6 +33,7 @@ extern struct multiset *gc_internal_multiset; int multiset_member(struct multiset *l, struct svalue *ind); struct multiset *allocate_multiset(struct array *ind); void really_free_multiset(struct multiset *l); +void do_free_multiset(struct multiset *l); void order_multiset(struct multiset *l); struct multiset *mkmultiset(struct array *ind); void multiset_insert(struct multiset *l, diff --git a/src/object.c b/src/object.c index 1a80fa5e4685aa06bf4eb248815ac85e2258574a..010142b703f3a09bf616c206dc35b621b196c76a 100644 --- a/src/object.c +++ b/src/object.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: object.c,v 1.131 2000/07/04 00:43:57 mast Exp $"); +RCSID("$Id: object.c,v 1.132 2000/07/06 23:25:26 mast Exp $"); #include "object.h" #include "dynamic_buffer.h" #include "interpret.h" @@ -252,7 +252,8 @@ static void call_pike_initializers(struct object *o, int args) void do_free_object(struct object *o) { - free_object(o); + if (o) + free_object(o); } struct object *debug_clone_object(struct program *p, int args) diff --git a/src/stralloc.c b/src/stralloc.c index 735f189f90f1850fe17800f5b771b3d0eaa889d2..047f0eef84d94fe54358c2ac2b5f1647c9c6f9ee 100644 --- a/src/stralloc.c +++ b/src/stralloc.c @@ -25,7 +25,7 @@ #define HUGE HUGE_VAL #endif /*!HUGE*/ -RCSID("$Id: stralloc.c,v 1.83 2000/06/27 15:24:34 grubba Exp $"); +RCSID("$Id: stralloc.c,v 1.84 2000/07/06 23:25:26 mast Exp $"); #define BEGIN_HASH_SIZE 997 #define MAX_AVG_LINK_LENGTH 3 @@ -712,7 +712,8 @@ void unlink_pike_string(struct pike_string *s) void do_free_string(struct pike_string *s) { - free_string(s); + if (s) + free_string(s); } void really_free_string(struct pike_string *s)