]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
bss_acpt.c: Free strings returned from previous BIO_ADDR_hostname_string() calls
author609bob <1850029304@qq.com>
Fri, 19 Dec 2025 02:27:06 +0000 (10:27 +0800)
committerTomas Mraz <tomas@openssl.org>
Wed, 31 Dec 2025 12:50:06 +0000 (13:50 +0100)
CLA: trivial

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29452)

crypto/bio/bss_acpt.c

index 80e62df825fb56c807bb07e38e9bccb78102e99c..c399357a3cbc124b50bad9d6c5fc877504f78647 100644 (file)
@@ -266,6 +266,9 @@ static int acpt_state(BIO *b, BIO_ACCEPT *c)
                 }
             }
 
+            /* Free old values before assigning new ones to prevent memory leak */
+            OPENSSL_free(c->cache_accepting_name);
+            OPENSSL_free(c->cache_accepting_serv);
             c->cache_accepting_name = BIO_ADDR_hostname_string(&c->cache_accepting_addr, 1);
             c->cache_accepting_serv = BIO_ADDR_service_string(&c->cache_accepting_addr, 1);
             c->state = ACPT_S_ACCEPT;