]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ssl/ech/ech_internal.c: avoid memory leak on ech_decode_inbound_ech() error path
authorEugene Syromiatnikov <esyr@openssl.org>
Mon, 23 Feb 2026 04:33:55 +0000 (05:33 +0100)
committerTomas Mraz <tomas@openssl.org>
Wed, 25 Feb 2026 11:10:24 +0000 (12:10 +0100)
Free allocated tmpenc in case of subsequent PACKET_copy_bytes() failure.

Reolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1681456
Fixes: 6c3edd4f3a8a "Add server-side handling of Encrypted Client Hello"
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:49 2026
(Merged from https://github.com/openssl/openssl/pull/30139)

ssl/ech/ech_internal.c

index cb9b846e3f1bc100298c1de7d743c802aaa11e06..ca6eaa8c8c52c61d7daf933287b4a17d210e811c 100644 (file)
@@ -1331,6 +1331,7 @@ static int ech_decode_inbound_ech(SSL_CONNECTION *s, PACKET *pkt,
         if (tmpenc == NULL)
             goto err;
         if (!PACKET_copy_bytes(pkt, tmpenc, pval_tmp)) {
+            OPENSSL_free(tmpenc);
             SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_BAD_EXTENSION);
             goto err;
         }