pgsql: Delay creation of SSL_CTX structure to allow cleanup

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Delay creation of SSL_CTX structure to allow cleanup
Date: 2026-10-06 11:52:22
Message-ID: E1xE3iY-00000000Y0H-3Cjt@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Delay creation of SSL_CTX structure to allow cleanup

Avoid initializing the OpenSSL SSL_CTX structure for a new host
until it has been checked for errors. The cleanup can only see
hosts which were successfully added so the previous coding would
leak the SSL_CTX on failed reloads.

Author: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Reviewed-by: Daniel Gustafsson <daniel(at)yesql(dot)se>
Reviewed-by: Rui Zhao <zhaorui126(at)gmail(dot)com>
Discussion: https://postgr.es/m/A1745424-7110-41E9-B98C-3CED1A034A8F@yesql.se
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b0faa1d2142a088963f8e0d0cf0ce9e5fe268223

Modified Files
--------------
src/backend/libpq/be-secure-openssl.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-10-06 11:52:32 pgsql: Clear SSL_hosts when destroying TLS
Previous Message Etsuro Fujita 2026-10-06 09:35:20 pgsql: postgres_fdw: Fix typo in server version check in AcquireSampleR