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=117dc48fd587099dfb2d0fc107c84f0e359284ad;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) --- diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c index 80e62df825f..c399357a3cb 100644 --- a/crypto/bio/bss_acpt.c +++ b/crypto/bio/bss_acpt.c @@ -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;