Fix possible memory leak in rescanLatestTimeLine()

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Fix possible memory leak in rescanLatestTimeLine()
Date: 2024-09-09 01:53:35
Message-ID: 20240909105335.a09722e833a849f118ca5ce0@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In rescanLatestTimeLine(), if a new target timeline is found, expectedTLEs is
replaced with newExpectedTLEs that is newly allocated by readTimeLineHistory(),
and old expectedTLEs is released using list_free_deep().

However, if the current timeline is not part of the history of the new timeline,
the function returns without using newExpectedTLEs, nor releasing it. I wonder
this is a memory leak and it is better to release it, although the affect may
be not so much.

I've attached the patch.

Regards,
Yugo Nagata

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
Fix_possible_memory_leak_in_rescanLatestTimeLine.patch text/x-diff 714 bytes

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2024-09-09 01:54:57 Re: DOCS - pg_replication_slot . Fix the 'inactive_since' description
Previous Message Joe Conway 2024-09-09 01:37:55 Re: CI, macports, darwin version problems