]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test/ech_test.c: avoid memory leaks in ech_api_basic_calls()
authorEugene Syromiatnikov <esyr@openssl.org>
Mon, 23 Feb 2026 05:42:00 +0000 (06:42 +0100)
committerTomas Mraz <tomas@openssl.org>
Wed, 25 Feb 2026 11:10:24 +0000 (12:10 +0100)
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 <esyr@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Wed Feb 25 11:10:58 2026
(Merged from https://github.com/openssl/openssl/pull/30139)

test/ech_test.c

index 86750d7e40104205e284ea010cd19771c509b035..97369f0d1da3e0ea830afc1ddb6e3f6f3722e41e 100644 (file)
@@ -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;