]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ssl/ech/ech_store.c: avoid memory leak on error path in OSSL_ECHSTORE_new
authorEugene Syromiatnikov <esyr@openssl.org>
Mon, 23 Feb 2026 04:38:19 +0000 (05:38 +0100)
committerTomas Mraz <tomas@openssl.org>
Wed, 25 Feb 2026 11:10:24 +0000 (12:10 +0100)
Free the newly allocated OSSL_ECHSTORE in case of propq duplication
failure before return.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681457
Fixes: 7debe0ddeff7 "ECH external APIs"
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:50 2026
(Merged from https://github.com/openssl/openssl/pull/30139)

ssl/ech/ech_store.c

index c9ef390554f02114357150e8be6831530b235049..6fb1dcd66909a068b3bf4b07f84a784c56f88b27 100644 (file)
@@ -617,6 +617,7 @@ OSSL_ECHSTORE *OSSL_ECHSTORE_new(OSSL_LIB_CTX *libctx, const char *propq)
     if (propq != NULL) {
         es->propq = OPENSSL_strdup(propq);
         if (es->propq == NULL) {
+            OPENSSL_free(es);
             ERR_raise(ERR_LIB_SSL, ERR_R_INTERNAL_ERROR);
             return 0;
         }