diff options
author | Sebastian Hahn <sebastian@torproject.org> | 2009-09-28 16:37:01 +0200 |
---|---|---|
committer | Sebastian Hahn <sebastian@torproject.org> | 2009-12-12 03:29:44 +0100 |
commit | 3807db001d71c51e53c1897ae067671f5b771f2f (patch) | |
tree | 6c6f648f072d24e7bbf554de12519b27cd9ef888 /src/or/rendservice.c | |
parent | 4afdb79051f7b1caba49877fb57be60bda9d4514 (diff) | |
download | tor-3807db001d71c51e53c1897ae067671f5b771f2f.tar tor-3807db001d71c51e53c1897ae067671f5b771f2f.tar.gz |
*_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.
Diffstat (limited to 'src/or/rendservice.c')
-rw-r--r-- | src/or/rendservice.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c index b6981d625..445fbffb0 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -87,7 +87,8 @@ num_rend_services(void) static void rend_authorized_client_free(rend_authorized_client_t *client) { - if (!client) return; + if (!client) + return; if (client->client_key) crypto_free_pk_env(client->client_key); tor_free(client->client_name); @@ -106,7 +107,9 @@ rend_authorized_client_strmap_item_free(void *authorized_client) static void rend_service_free(rend_service_t *service) { - if (!service) return; + if (!service) + return; + tor_free(service->directory); SMARTLIST_FOREACH(service->ports, void*, p, tor_free(p)); smartlist_free(service->ports); @@ -134,9 +137,9 @@ rend_service_free(rend_service_t *service) void rend_service_free_all(void) { - if (!rend_service_list) { + if (!rend_service_list) return; - } + SMARTLIST_FOREACH(rend_service_list, rend_service_t*, ptr, rend_service_free(ptr)); smartlist_free(rend_service_list); |