Re: Fix memory leak in tzparser.c

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Shixin Wang <wang-shi-xin(at)outlook(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix memory leak in tzparser.c
Date: 2025-12-16 07:59:35
Message-ID: aUERZ_xGYW8vjwFQ@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 16, 2025 at 05:55:32AM +0000, Shixin Wang wrote:
> While the memory is managed by a temp memory context that gets cleaned up
> eventually, the coarse-grained management might cause some memory to
> accumulate during ParseTzFile() recursive calls when processing @INCLUDE
> directives.
>
> I've attached a patch with this change in case anyone thinks it's worth
> applying.

Why does it matter? load_tzoffsets() is the sole caller of
ParseTzFile() and it uses a temporary memory context named
TZParserMemory to not have to do cleanups like the one you are
proposing here.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2025-12-16 08:05:17 Re: Periodic authorization expiration checks using GoAway message
Previous Message Michael Paquier 2025-12-16 07:55:28 Re: [PATCH]Remove the redundant assignment