From: Anirudh Ramachandran Date: Fri, 7 Apr 2017 18:58:27 +0000 (-0700) Subject: Fix leak in HMAC_CTX_free compat API X-Git-Tag: v2017.04.10.00~7 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=9620aea0e79b41aa466ace8e322f9b7bb7005a4c;p=folly.git Fix leak in HMAC_CTX_free compat API Summary: D4406876 replaced EVP_MD_CTX and HMAC_CTX on the stack with heap-allocated versions. We omitted the _cleanup functions thinking those didn't actually free anything, but turns out HMAC_CTX_cleanup internally calls EVP_MD_CTX_cleanup which OPENSSL_frees a bunch of stuff. Reviewed By: yfeldblum Differential Revision: D4850388 fbshipit-source-id: 4ef1413a4105f3638140e4d12aeae64afe43f099 --- diff --git a/folly/portability/OpenSSL.cpp b/folly/portability/OpenSSL.cpp index 6c1f66dc..43a4692b 100644 --- a/folly/portability/OpenSSL.cpp +++ b/folly/portability/OpenSSL.cpp @@ -70,6 +70,7 @@ HMAC_CTX* HMAC_CTX_new(void) { void HMAC_CTX_free(HMAC_CTX* ctx) { if (ctx) { + HMAC_CTX_cleanup(ctx); OPENSSL_free(ctx); } }