summaryrefslogtreecommitdiffstats
path: root/freebsd/crypto/openssl/crypto/hmac/hm_pmeth.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/crypto/openssl/crypto/hmac/hm_pmeth.c')
-rw-r--r--freebsd/crypto/openssl/crypto/hmac/hm_pmeth.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/freebsd/crypto/openssl/crypto/hmac/hm_pmeth.c b/freebsd/crypto/openssl/crypto/hmac/hm_pmeth.c
index 4da672ee..123b76aa 100644
--- a/freebsd/crypto/openssl/crypto/hmac/hm_pmeth.c
+++ b/freebsd/crypto/openssl/crypto/hmac/hm_pmeth.c
@@ -101,15 +101,18 @@ static int pkey_hmac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
sctx = src->data;
dctx = dst->data;
dctx->md = sctx->md;
- HMAC_CTX_init(&dctx->ctx);
if (!HMAC_CTX_copy(&dctx->ctx, &sctx->ctx))
- return 0;
- if (sctx->ktmp.data) {
+ goto err;
+ if (sctx->ktmp.data != NULL) {
if (!ASN1_OCTET_STRING_set(&dctx->ktmp,
sctx->ktmp.data, sctx->ktmp.length))
- return 0;
+ goto err;
}
return 1;
+ err:
+ HMAC_CTX_cleanup(&dctx->ctx);
+ OPENSSL_free(dctx);
+ return 0;
}
static void pkey_hmac_cleanup(EVP_PKEY_CTX *ctx)