[PATCH] crypto: don't check for NULL before kfree(), it's redundant.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Checking a pointer for NULL before calling kfree() on it is redundant. 
This patch removes such checks from crypto/

Signed-off-by: Jesper Juhl <[email protected]>

diff -up linux-2.6.12-rc1-mm4-orig/crypto/cipher.c linux-2.6.12-rc1-mm4/crypto/cipher.c
--- linux-2.6.12-rc1-mm4-orig/crypto/cipher.c	2005-03-31 21:19:49.000000000 +0200
+++ linux-2.6.12-rc1-mm4/crypto/cipher.c	2005-04-04 23:58:58.000000000 +0200
@@ -336,6 +336,5 @@ out:	
 
 void crypto_exit_cipher_ops(struct crypto_tfm *tfm)
 {
-	if (tfm->crt_cipher.cit_iv)
-		kfree(tfm->crt_cipher.cit_iv);
+	kfree(tfm->crt_cipher.cit_iv);
 }
diff -up linux-2.6.12-rc1-mm4-orig/crypto/hmac.c linux-2.6.12-rc1-mm4/crypto/hmac.c
--- linux-2.6.12-rc1-mm4-orig/crypto/hmac.c	2005-03-02 08:38:09.000000000 +0100
+++ linux-2.6.12-rc1-mm4/crypto/hmac.c	2005-04-04 23:59:22.000000000 +0200
@@ -49,8 +49,7 @@ int crypto_alloc_hmac_block(struct crypt
 
 void crypto_free_hmac_block(struct crypto_tfm *tfm)
 {
-	if (tfm->crt_digest.dit_hmac_block)
-		kfree(tfm->crt_digest.dit_hmac_block);
+	kfree(tfm->crt_digest.dit_hmac_block);
 }
 
 void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen)



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux