From: 609bob <1850029304@qq.com> Date: Fri, 19 Dec 2025 02:27:06 +0000 (+0800) Subject: bss_acpt.c: Free strings returned from previous BIO_ADDR_hostname_string() calls X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fopenssl-3.0;p=thirdparty%2Fopenssl.git bss_acpt.c: Free strings returned from previous BIO_ADDR_hostname_string() calls CLA: trivial Reviewed-by: Richard Levitte Reviewed-by: Frederik Wedel-Heinen Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/29452) (cherry picked from commit 117dc48fd587099dfb2d0fc107c84f0e359284ad) --- diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c index 8c41ae73f3d..7c7a6a46458 100644 --- a/crypto/bio/bss_acpt.c +++ b/crypto/bio/bss_acpt.c @@ -268,6 +268,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;