aboutsummaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2010-10-26 18:22:04 +0200
committerSebastian Hahn <sebastian@torproject.org>2011-10-26 14:17:01 +0200
commit3a890b3b70d53ac864be682f50f07ba07b8f09ba (patch)
treee04afdca93d423da2e0964cb5af0efbcc2d5c987 /src/common/crypto.c
parentdc557e8164003d6c09b620333902d7dae3762794 (diff)
downloadtor-3a890b3b70d53ac864be682f50f07ba07b8f09ba.tar
tor-3a890b3b70d53ac864be682f50f07ba07b8f09ba.tar.gz
Properly refcount client_identity_key
In a2bb0bf we started using a separate client identity key. When we are in "public server mode" (that means not a bridge) we will use the same key. Reusing the key without doing the proper refcounting leads to a segfault on cleanup during shutdown. Fix that. Also introduce an assert that triggers if our refcount falls below 0. That should never happen.
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r--src/common/crypto.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index c723c33dd..a444cf126 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -326,6 +326,7 @@ crypto_free_pk_env(crypto_pk_env_t *env)
if (--env->refs > 0)
return;
+ tor_assert(env->refs == 0);
if (env->key)
RSA_free(env->key);