bss_acpt.c: Free strings returned from previous BIO_ADDR_hostname_string() calls

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)
This commit is contained in:
609bob
2025-12-19 10:27:06 +08:00
committed by Tomas Mraz
parent 2d75c5e383
commit 117dc48fd5

View 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;