lsyscache: free IndexAmRoutine objects returned by GetIndexAmRoutineByAmId()

Started by Chao Li6 months ago1 messageshackers
Jump to latest
#1Chao Li
li.evan.chao@gmail.com

Hi Hackers,

I noticed this problem while reviewing Tom’s patch [1]/messages/by-id/2380165.1766871097@sss.pgh.pa.us. 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]: /messages/by-id/2380165.1766871097@sss.pgh.pa.us

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachments:

v1-0001-lsyscache-free-IndexAmRoutine-objects-returned-by.patchapplication/octet-stream; name=v1-0001-lsyscache-free-IndexAmRoutine-objects-returned-by.patchDownload+12-4