| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | lsyscache: free IndexAmRoutine objects returned by GetIndexAmRoutineByAmId() |
| Date: | 2025-12-29 09:21:26 |
| Message-ID: | CAEoWx2=vApYk2LRu8R0DdahsPNEhWUxGBZ=rbZo1EXE=uA+opQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Hackers,
I noticed this problem while reviewing Tom’s patch [1]. In lsyscache.c,
there are multiple places that get IndexAmRoutine
by GetIndexAmRoutineByAmId(). Only one function get_opmethod_canorder()
pfree the returned object, while the other 3
functions get_op_index_interpretation(), equality_ops_are_compatible()
and comparison_ops_are_compatible() all call GetIndexAmRoutineByAmId() in
for loops but without freeing the memory.
While these paths are not hot enough to cause leaks that matter in
practice, I think for consistency, we should free the memory.
[1] https://postgr.es/m/2380165.1766871097@sss.pgh.pa.us
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-lsyscache-free-IndexAmRoutine-objects-returned-by.patch | application/octet-stream | 2.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2025-12-29 09:28:06 | Re: Don't cast away const where possible |
| Previous Message | Bertrand Drouvot | 2025-12-29 09:01:46 | Re: Don't cast away const where possible |