From: Eugene Syromiatnikov Date: Mon, 23 Feb 2026 05:42:00 +0000 (+0100) Subject: test/ech_test.c: avoid memory leaks in ech_api_basic_calls() X-Git-Tag: openssl-4.0.0-alpha1~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6c9ce7e671257dc9663ef02b2ab28edc19b4c5d;p=thirdparty%2Fopenssl.git test/ech_test.c: avoid memory leaks in ech_api_basic_calls() rinner and router should be freed after successful SSL_ech_get1_status() calls. Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681465 Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681466 Fixes: 5e5a76fc2c08 "Add tests and documentation and fix a couple of issues identified by added tests" Signed-off-by: Eugene Syromiatnikov Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz MergeDate: Wed Feb 25 11:10:58 2026 (Merged from https://github.com/openssl/openssl/pull/30139) --- diff --git a/test/ech_test.c b/test/ech_test.c index 86750d7e401..97369f0d1da 100644 --- a/test/ech_test.c +++ b/test/ech_test.c @@ -1084,8 +1084,8 @@ static int ech_api_basic_calls(void) SSL_CTX *ctx = NULL; SSL *s = NULL; OSSL_ECHSTORE *es = NULL, *es1 = NULL; - char *rinner, *inner = "inner.example.com"; - char *router, *outer = "example.com"; + char *rinner = NULL, *inner = "inner.example.com"; + char *router = NULL, *outer = "example.com"; unsigned char alpns[] = { 'h', '2' }; size_t alpns_len = sizeof(alpns); char *gsuite = "X25519,hkdf-sha256,aes-256-gcm"; @@ -1169,6 +1169,8 @@ end: BIO_free_all(in); OSSL_ECHSTORE_free(es1); OSSL_ECHSTORE_free(es); + OPENSSL_free(router); + OPENSSL_free(rinner); SSL_CTX_free(ctx); SSL_free(s); return rv;