Re: Fix memory leak in tzparser.c

2025-12-17 Thread Tom Lane
Ashutosh Bapat writes: > On Tue, Dec 16, 2025 at 1:29 PM Michael Paquier wrote: >> 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. > +1.

Re: Fix memory leak in tzparser.c

2025-12-17 Thread Ashutosh Bapat
On Tue, Dec 16, 2025 at 1:29 PM Michael Paquier wrote: > > On Tue, Dec 16, 2025 at 05:55:32AM +, 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 Parse

Re: Fix memory leak in tzparser.c

2025-12-16 Thread Michael Paquier
On Tue, Dec 16, 2025 at 05:55:32AM +, 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. >

Fix memory leak in tzparser.c

2025-12-15 Thread Shixin Wang
Hi hackers, I noticed a memory leak in the addToArray() function in src/backend/utils/misc/tzparser.c. When the override parameter is true and a duplicate timezone abbreviation is found, the code overwrites midptr->zone without freeing the previously allocated memory. The fix would be: -