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/circuitlist.c | |
parent | 4afdb79051f7b1caba49877fb57be60bda9d4514 (diff) | |
download | tor-3807db001d71c51e53c1897ae067671f5b771f2f.tar.gz tor-3807db001d71c51e53c1897ae067671f5b771f2f.zip |
*_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/circuitlist.c')
-rw-r--r-- | src/or/circuitlist.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index 02bf925ba5..e0cb644864 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -442,7 +442,9 @@ circuit_free(circuit_t *circ) { void *mem; size_t memlen; - tor_assert(circ); + if (!circ) + return; + if (CIRCUIT_IS_ORIGIN(circ)) { origin_circuit_t *ocirc = TO_ORIGIN_CIRCUIT(circ); mem = ocirc; @@ -558,6 +560,9 @@ circuit_free_all(void) static void circuit_free_cpath_node(crypt_path_t *victim) { + if (!victim) + return; + if (victim->f_crypto) crypto_free_cipher_env(victim->f_crypto); if (victim->b_crypto) |