From 24d907940d2fc8f2850b0ba57ebd98c5d7d8f667 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Tue, 19 Apr 2022 13:45:32 +0200 Subject: [PATCH v2 1/2] Fix small memory leak in psql \d The memory allocated to store table information wasn't freed causing a small leak. Fix by freeing like we do for other allocations in the same codepath. Author: Wentao Liang Reviewed-by: Kyotaro Horiguchi Discussion: https://postgr.es/m/38da8aa3.14ec.17f0be3d3ad.Coremail.wliang@stu.xidian.edu.cn --- src/bin/psql/describe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 583817b0cc..6c8aa289c1 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3452,6 +3452,13 @@ error_return: if (view_def) free(view_def); + if (tableinfo.reloptions) + free(tableinfo.reloptions); + if (tableinfo.reloftype) + free(tableinfo.reloftype); + if (tableinfo.relam) + free(tableinfo.relam); + if (res) PQclear(res); -- 2.32.0 (Apple Git-132)