From 3807db001d71c51e53c1897ae067671f5b771f2f Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Mon, 28 Sep 2009 16:37:01 +0200 Subject: *_free functions now accept NULL Some *_free functions threw asserts when passed NULL. Now all of them accept NULL as input and perform no action when called that way. This gains us consistence for our free functions, and allows some code simplifications where an explicit null check is no longer necessary. --- src/or/connection_edge.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/or/connection_edge.c') diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 75a57fedd5..b0ba96164e 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -688,7 +688,11 @@ addressmap_init(void) static void addressmap_ent_free(void *_ent) { - addressmap_entry_t *ent = _ent; + addressmap_entry_t *ent; + if (!_ent) + return; + + ent = _ent; tor_free(ent->new_address); tor_free(ent); } @@ -697,7 +701,11 @@ addressmap_ent_free(void *_ent) static void addressmap_virtaddress_ent_free(void *_ent) { - virtaddress_entry_t *ent = _ent; + virtaddress_entry_t *ent; + if (!_ent) + return; + + ent = _ent; tor_free(ent->ipv4_address); tor_free(ent->hostname_address); tor_free(ent); -- cgit v1.2.3-54-g00ecf