aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/hmac/hm_ameth.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/hmac/hm_ameth.c')
-rw-r--r--crypto/hmac/hm_ameth.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/hmac/hm_ameth.c b/crypto/hmac/hm_ameth.c
index 29b2b5dffcf7..944c6c857b17 100644
--- a/crypto/hmac/hm_ameth.c
+++ b/crypto/hmac/hm_ameth.c
@@ -108,9 +108,14 @@ static int old_hmac_decode(EVP_PKEY *pkey,
ASN1_OCTET_STRING *os;
os = ASN1_OCTET_STRING_new();
if (!os || !ASN1_OCTET_STRING_set(os, *pder, derlen))
- return 0;
- EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os);
+ goto err;
+ if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os))
+ goto err;
return 1;
+
+ err:
+ ASN1_OCTET_STRING_free(os);
+ return 0;
}
static int old_hmac_encode(const EVP_PKEY *pkey, unsigned char **pder)