1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Clear SSL_hosts when destroying TLS

The loaded SSL_CTX objects were cleared on SSL initialization but not
when destroying the TLS objects via be_tls_destroy().  This would not
leak the contexts, but consume memory for no reason.

Reported-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Rui Zhao <zhaorui126@gmail.com>
Discussion: https://postgr.es/m/CAOYmi+mAtEn4wN3xx=r4TaY5AHy9_q9XncM8YQLhofE3op0SvA@mail.gmail.com
Backpatch-through: 19
This commit is contained in:
Daniel Gustafsson
2026-10-06 13:27:06 +02:00
parent b6adefc659
commit d45dc682e8

View File

@@ -846,6 +846,13 @@ be_tls_destroy(void)
SSL_CTX_free(SSL_context);
SSL_context = NULL;
ssl_loaded_verify_locations = false;
if (SSL_hosts_memcxt)
{
MemoryContextDelete(SSL_hosts_memcxt);
SSL_hosts_memcxt = NULL;
SSL_hosts = NULL;
}
}
int