aboutsummaryrefslogtreecommitdiff
path: root/crypto/ffc/ffc_params.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ffc/ffc_params.c')
-rw-r--r--crypto/ffc/ffc_params.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/ffc/ffc_params.c b/crypto/ffc/ffc_params.c
index 9815360a4e8c..ce0f7e08c97b 100644
--- a/crypto/ffc/ffc_params.c
+++ b/crypto/ffc/ffc_params.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2019-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -182,8 +182,10 @@ int ossl_ffc_params_copy(FFC_PARAMS *dst, const FFC_PARAMS *src)
if (!ffc_bn_cpy(&dst->p, src->p)
|| !ffc_bn_cpy(&dst->g, src->g)
|| !ffc_bn_cpy(&dst->q, src->q)
- || !ffc_bn_cpy(&dst->j, src->j))
+ || !ffc_bn_cpy(&dst->j, src->j)) {
+ ossl_ffc_params_cleanup(dst);
return 0;
+ }
dst->mdname = src->mdname;
dst->mdprops = src->mdprops;
@@ -191,8 +193,10 @@ int ossl_ffc_params_copy(FFC_PARAMS *dst, const FFC_PARAMS *src)
dst->seedlen = src->seedlen;
if (src->seed != NULL) {
dst->seed = OPENSSL_memdup(src->seed, src->seedlen);
- if (dst->seed == NULL)
+ if (dst->seed == NULL) {
+ ossl_ffc_params_cleanup(dst);
return 0;
+ }
} else {
dst->seed = NULL;
}