Re: cleanup in open_auth_file

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Ted Yu <yuzhihong@gmail.com>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-11-24T01:19:16Z
Lists: pgsql-hackers
On Wed, Nov 23, 2022 at 05:09:22PM -0800, Ted Yu wrote:
> Thinking more on this.
> The context should be created when the file is successfully opened.

Indeed.  Both operations ought to be done in the reverse order, or we
would run into leaks in the postmaster on reload if pg_ident.conf has
been removed, for example, and this is prefectly valid.  That's what
the previous logic did, actually.  Will fix in a minute..
--
Michael

Commits

  1. Create memory context for tokenization after opening top-level file in hba.c

  2. Rework memory contexts in charge of HBA/ident tokenization