Blame SOURCES/fix-memory-leak-evp-sign-verify.patch

aae78f
diff --git a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c
aae78f
index 2124978..1f853b4 100644
aae78f
--- a/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c
aae78f
+++ b/src/vendor/github.com/golang-fips/openssl-fips/openssl/openssl_evp.c
aae78f
@@ -44,7 +44,11 @@ int _goboringcrypto_EVP_sign_raw(EVP_MD *md, EVP_PKEY_CTX *ctx, const uint8_t *m
aae78f
                              GO_RSA *rsa_key) {
aae78f
   int ret = 0;
aae78f
   GO_EVP_PKEY *pk = _goboringcrypto_EVP_PKEY_new();
aae78f
-  _goboringcrypto_EVP_PKEY_assign_RSA(pk, rsa_key);
aae78f
+  if (!pk)
aae78f
+    return 0;
aae78f
+
aae78f
+  if (!(_goboringcrypto_EVP_PKEY_set1_RSA(pk, rsa_key)))
aae78f
+    goto err;
aae78f
 
aae78f
   if (!ctx && !(ctx = _goboringcrypto_EVP_PKEY_CTX_new(pk, NULL)))
aae78f
     goto err;
aae78f
@@ -64,6 +68,8 @@ int _goboringcrypto_EVP_sign_raw(EVP_MD *md, EVP_PKEY_CTX *ctx, const uint8_t *m
aae78f
 err:
aae78f
   if (ctx)
aae78f
     _goboringcrypto_EVP_PKEY_CTX_free(ctx);
aae78f
+  if (pk)
aae78f
+    _goboringcrypto_EVP_PKEY_free(pk);
aae78f
 
aae78f
   return ret;
aae78f
 }
aae78f
@@ -104,7 +110,11 @@ int _goboringcrypto_EVP_verify_raw(const uint8_t *msg, size_t msgLen,
aae78f
   int ret = 0;
aae78f
   EVP_PKEY_CTX *ctx;
aae78f
   GO_EVP_PKEY *pk = _goboringcrypto_EVP_PKEY_new();
aae78f
-  _goboringcrypto_EVP_PKEY_assign_RSA(pk, rsa_key);
aae78f
+  if (!pk)
aae78f
+    return 0;
aae78f
+
aae78f
+  if (!(_goboringcrypto_EVP_PKEY_set1_RSA(pk, rsa_key)))
aae78f
+    goto err;
aae78f
 
aae78f
   if (!(ctx = _goboringcrypto_EVP_PKEY_CTX_new(pk, NULL)))
aae78f
     goto err;
aae78f
@@ -124,6 +134,8 @@ int _goboringcrypto_EVP_verify_raw(const uint8_t *msg, size_t msgLen,
aae78f
 err:
aae78f
   if (ctx)
aae78f
     _goboringcrypto_EVP_PKEY_CTX_free(ctx);
aae78f
+  if (pk)
aae78f
+    _goboringcrypto_EVP_PKEY_free(pk);
aae78f
 
aae78f
   return ret;
aae78f
 }