summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-03-18 20:37:09 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-03-18 20:37:09 -0400
commit2bed650c4841cb63a8cede0db9452664f39bc314 (patch)
tree0be9ddffe261b11e3601850951c518ef1af1b601 /src
parent2a4c9fd9c77041fc7207c268eaf0155d11f100a2 (diff)
Don't leak rd_statlist when a relcache entry is dropped.
Although these lists are usually NIL, and even when not empty are unlikely to be large, constant relcache update traffic could eventually result in visible bloat of CacheMemoryContext. Found via valgrind testing. Back-patch to v10 where this field was added. Discussion: https://postgr.es/m/3816764.1616104288@sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/cache/relcache.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index d353db40a20..a6f1f1f98a6 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -2391,6 +2391,7 @@ RelationDestroyRelation(Relation relation, bool remember_tupdesc)
FreeTriggerDesc(relation->trigdesc);
list_free_deep(relation->rd_fkeylist);
list_free(relation->rd_indexlist);
+ list_free(relation->rd_statlist);
bms_free(relation->rd_indexattr);
bms_free(relation->rd_keyattr);
bms_free(relation->rd_pkattr);