[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Remove a couple redundant NULL-checks before crypto_cipher_free



commit ab3197c0596de087f43c08bda500fcc36ba2ef20
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Mar 30 10:16:58 2012 -0400

    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.
---
 src/common/crypto.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/common/crypto.c b/src/common/crypto.c
index e79666f..dd85d14 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;
 }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits