]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4633] Addressed some comments
authorFrancis Dupont <fdupont@isc.org>
Thu, 8 Dec 2016 17:36:38 +0000 (18:36 +0100)
committerFrancis Dupont <fdupont@isc.org>
Thu, 8 Dec 2016 17:36:38 +0000 (18:36 +0100)
src/lib/cryptolink/openssl_compat.h

index ef354eef3b3bf54dffd8969d3766d299c7ca8f0d..886d951df106649c410c82b271f0871c4c443c75 100644 (file)
@@ -8,6 +8,9 @@
 
 #if OPENSSL_VERSION_NUMBER < 0x10100000L
 
+// This file is included by hash and hmac codes so KEA_H* macros
+// avoid to define unused inlines.
+
 #ifdef KEA_HASH
 
 // EVP_MD_CTX_new() is EVP_MD_CTX_create() in OpenSSL < 1.1
@@ -39,8 +42,10 @@ inline HMAC_CTX* HMAC_CTX_new() {
 // HMAC_CTX_free() implementation for OpenSSL < 1.1
 
 inline void HMAC_CTX_free(HMAC_CTX* ctx) {
-    HMAC_CTX_cleanup(ctx);
-    OPENSSL_free(ctx);
+    if (ctx != 0) {
+        HMAC_CTX_cleanup(ctx);
+        OPENSSL_free(ctx);
+    }
 }
 
 #endif