From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove code in charge of freeing regexps generation by Lab.c
Date: Thu, 13 Apr 2023 22:28:21 +0000
Message-ID: <E1pn5QS-002vsQ-2T@gemulon.postgresql.org> (raw)
Remove code in charge of freeing regexps generation by Lab.c
bea3d7e has redesigned the regexp engine so as all the allocations go
through palloc() with a dedicated memory context. hba.c had to cope
with the past memory management logic by going through all the HBA and
ident lines generated, then directly free all the regexps found in
AuthTokens to ensure that no leaks would happen. Such leaks could
happen for example in the postmaster after a SIGHUP, in the event of
an HBA and/or ident reload failure where all the new content parsed must
be discarded, including all the regexps that may have been compiled.
Now that regexps are palloc()'d in their own memory context,
MemoryContextDelete() is enough to ensure that all the compiled regexps
are properly gone. Simplifying this logic in hba.c has the effect to
only remove code. Most of it is new in v16, except the part for regexps
compiled in ident entries for the system username, so doing this cleanup
now rather than when v17 opens for business will reduce future diffs
with the upcoming REL_16_STABLE.
Some comments were incorrect since bea3d7e, now fixed to reflect the
reality.
Reviewed-by: Bertrand Drouvot, Álvaro Herrera
Discussion: https://postgr.es/m/ZDdJ289Ky2qEj4h+@paquier.xyz
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a28269708844246fb1ec00a536b391cac0a64972
Modified Files
--------------
src/backend/libpq/hba.c | 72 ++++---------------------------------------------
1 file changed, 5 insertions(+), 67 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Remove code in charge of freeing regexps generation by Lab.c
In-Reply-To: <E1pn5QS-002vsQ-2T@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox