summaryrefslogtreecommitdiffstats
path: root/test/evp_test.c
diff options
context:
space:
mode:
authorFrederik Wedel-Heinen <frederik.wedel-heinen@dencrypt.dk>2024-12-20 15:45:53 +0100
committerTomas Mraz <tomas@openssl.org>2025-01-08 11:25:30 +0100
commit2457fc4816551a7e982117a4032fd1c259c493a7 (patch)
treeb73ee9b50686395c95ba3479c221363e67168f13 /test/evp_test.c
parentReturn NULL from ossl_lib_ctx_get_concrete() when it is uninitialized (diff)
downloadopenssl-2457fc4816551a7e982117a4032fd1c259c493a7.tar.xz
openssl-2457fc4816551a7e982117a4032fd1c259c493a7.zip
Free data if sk_OPENSSL_STRING_push fails.
Fixes #26203 Reviewed-by: Paul Dale <ppzgs1@gmail.com> Reviewed-by: Saša Nedvědický <sashan@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/26227)
Diffstat (limited to '')
-rw-r--r--test/evp_test.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index 30a5c85468..4ca11f5829 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -202,7 +202,13 @@ static int ctrladd(STACK_OF(OPENSSL_STRING) *controls, const char *value)
if (data == NULL)
return -1;
- return sk_OPENSSL_STRING_push(controls, data) > 0;
+
+ if (sk_OPENSSL_STRING_push(controls, data) <= 0) {
+ OPENSSL_free(data);
+ return -1;
+ }
+
+ return 1;
}
/* Because OPENSSL_free is a macro, it can't be passed as a function pointer */