Blame SOURCES/net-snmp-5.7.2-key-leak-backport.patch

b5ae06
diff -urNp a/snmplib/keytools.c b/snmplib/keytools.c
b5ae06
--- a/snmplib/keytools.c	2018-11-26 14:48:35.967812631 +0100
b5ae06
+++ b/snmplib/keytools.c	2018-11-26 15:21:14.758817675 +0100
b5ae06
@@ -153,19 +153,21 @@ generate_Ku(const oid * hashtype, u_int
b5ae06
     ctx = EVP_MD_CTX_create();
b5ae06
 #else
b5ae06
     ctx = malloc(sizeof(*ctx));
b5ae06
-    EVP_MD_CTX_init(ctx);
b5ae06
+    if(!EVP_MD_CTX_init(ctx)){
b5ae06
+        QUITFUN(SNMPERR_GENERR, generate_Ku_quit);
b5ae06
+    }
b5ae06
 #endif
b5ae06
 #ifndef NETSNMP_DISABLE_MD5
b5ae06
     if (ISTRANSFORM(hashtype, HMACMD5Auth)) {
b5ae06
         if (!EVP_DigestInit(ctx, EVP_md5()))
b5ae06
             /* MD5 not supported */
b5ae06
-            return SNMPERR_GENERR;
b5ae06
+            QUITFUN(SNMPERR_GENERR, generate_Ku_quit);
b5ae06
     } else
b5ae06
 #endif
b5ae06
         if (ISTRANSFORM(hashtype, HMACSHA1Auth)) {
b5ae06
             if (!EVP_DigestInit(ctx, EVP_sha1()))
b5ae06
                 /* SHA1 not supported */
b5ae06
-                return SNMPERR_GENERR;
b5ae06
+                QUITFUN(SNMPERR_GENERR, generate_Ku_quit);
b5ae06
         } else {
b5ae06
             QUITFUN(SNMPERR_GENERR, generate_Ku_quit);
b5ae06
         }
b5ae06
diff -urNp a/snmplib/scapi.c b/snmplib/scapi.c
b5ae06
--- a/snmplib/scapi.c	2018-11-26 14:48:35.967812631 +0100
b5ae06
+++ b/snmplib/scapi.c	2018-11-26 15:12:19.296751273 +0100
b5ae06
@@ -498,7 +498,8 @@ sc_hash(const oid * hashtype, size_t has
b5ae06
 #endif
b5ae06
     if (!EVP_DigestInit(cptr, hashfn)) {
b5ae06
         /* requested hash function is not available */
b5ae06
-        return SNMPERR_SC_NOT_CONFIGURED;
b5ae06
+        rval = SNMPERR_SC_NOT_CONFIGURED;
b5ae06
+	goto sc_hash_type_quit;
b5ae06
     }
b5ae06
 
b5ae06
 /** pass the data */
b5ae06
@@ -507,6 +508,8 @@ sc_hash(const oid * hashtype, size_t has
b5ae06
 /** do the final pass */
b5ae06
     EVP_DigestFinal(cptr, MAC, &tmp_len);
b5ae06
     *MAC_len = tmp_len;
b5ae06
+
b5ae06
+sc_hash_type_quit:
b5ae06
 #ifdef HAVE_EVP_MD_CTX_DESTROY
b5ae06
     EVP_MD_CTX_destroy(cptr);
b5ae06
 #else