]> git.meshlink.io Git - meshlink/blobdiff - src/openssl/cipher.c
Fix memory leaks found by valgrind.
[meshlink] / src / openssl / cipher.c
index 1ca15abb1817693f9a37b73946f116bd9e90f94d..abd652c443121ec184208f18cc9ab10eed1df803 100644 (file)
@@ -65,10 +65,8 @@ bool cipher_open_blowfish_ofb(cipher_t *cipher) {
 
 void cipher_close(cipher_t *cipher) {
        EVP_CIPHER_CTX_cleanup(&cipher->ctx);
-       if(cipher->counter) {
-               free(cipher->counter);
-               cipher->counter = 0;
-       }
+       free(cipher->counter);
+       cipher->counter = NULL;
 }
 
 size_t cipher_keylength(const cipher_t *cipher) {