Re: [PATCH] Free memory allocated by waitonlock_error_callback()
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Quan Zongliang <quanzongliang@yeah.net>
Cc: Aleksander Alekseev <aleksander@tigerdata.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2025-10-23T04:08:22Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Provide error context when an error is thrown within WaitOnLock().
- f727b63e8107 19 (unreleased) cited
On Thu, Oct 23, 2025 at 11:18:09AM +0800, Quan Zongliang wrote: > On 9/19/25 7:16 PM, Aleksander Alekseev wrote: >> Currently waitonlock_error_callback() allocates memory in ErrorContext >> and doesn't explicitly free it. Valgrind is not happy about it and >> generates multiple reports like this: > > Improve the completeness of the code. errfinish() calls MemoryContextReset() on ErrorContext so as any leaks like the one you are cleaning up are taken care of. Still, what you are suggesting is simple enough and silences a bit valgrind, so agreed about the addition of this pfree(). Let's see if somebody objects to that. -- Michael