]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix memory leak in isc_hmac_init
authorMark Andrews <marka@isc.org>
Fri, 24 Feb 2023 01:57:39 +0000 (12:57 +1100)
committerMark Andrews <marka@isc.org>
Sun, 26 Feb 2023 23:27:32 +0000 (10:27 +1100)
If EVP_DigestSignInit failed 'pkey' was not freed.

(cherry picked from commit cf5f13367965e5318487e0c31a56ba53cc2098b3)

lib/isc/hmac.c

index 7d62165555ee3bc54a955e4cd0e2aa48629fc357..8fce30bda907e14228234fc60d1cd4c3dd23e50a 100644 (file)
@@ -59,6 +59,7 @@ isc_hmac_init(isc_hmac_t *hmac, const void *key, const size_t keylen,
        }
 
        if (EVP_DigestSignInit(hmac, NULL, md_type, NULL, pkey) != 1) {
+               EVP_PKEY_free(pkey);
                return (ISC_R_CRYPTOFAILURE);
        }