summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-03-30 10:16:58 -0400
committerNick Mathewson <nickm@torproject.org>2012-03-30 10:16:58 -0400
commitab3197c0596de087f43c08bda500fcc36ba2ef20 (patch)
treed1adef5c5d3179a9e022d736abac2fd3c008317b
parent1da5223e893fd61ed171782809ed9a55eb3503c7 (diff)
downloadtor-ab3197c0596de087f43c08bda500fcc36ba2ef20.tar.gz
tor-ab3197c0596de087f43c08bda500fcc36ba2ef20.zip
Remove a couple redundant NULL-checks before crypto_cipher_free
Calling crypto_cipher_free(NULL) is always safe, since (by convention) all of our xyz_free() functions treat xyz_free(NULL) as a no-op. Flagged by coverity scan; fixes CID 508 and 509.
-rw-r--r--src/common/crypto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index e79666f955..dd85d14719 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -1055,7 +1055,7 @@ crypto_pk_public_hybrid_encrypt(crypto_pk_t *env,
memset(buf, 0, pkeylen);
tor_free(buf);
}
- if (cipher) crypto_cipher_free(cipher);
+ crypto_cipher_free(cipher);
return -1;
}
@@ -1112,7 +1112,7 @@ crypto_pk_private_hybrid_decrypt(crypto_pk_t *env,
err:
memset(buf,0,pkeylen);
tor_free(buf);
- if (cipher) crypto_cipher_free(cipher);
+ crypto_cipher_free(cipher);
return -1;
}