Commit 5366d8c942 for openssl.org

commit 5366d8c9420b3d266cf07fdcebf0789867da0928
Author: Eugene Syromiatnikov <esyr@openssl.org>
Date:   Mon Feb 23 05:38:19 2026 +0100

    ssl/ech/ech_store.c: avoid memory leak on error path in OSSL_ECHSTORE_new

    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)

diff --git a/ssl/ech/ech_store.c b/ssl/ech/ech_store.c
index c9ef390554..6fb1dcd669 100644
--- a/ssl/ech/ech_store.c
+++ b/ssl/ech/ech_store.c
@@ -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;
         }