pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[PATCH v5 1/1] fix the memory leak in psql describe
1+ messages / 1 participants
[nested] [flat]

* [PATCH v5 1/1] fix the memory leak in psql describe
@ 2022-07-20 06:12 Japin Li <japinli@hotmail.com>
  0 siblings, 0 replies; 1+ messages in thread

From: Japin Li @ 2022-07-20 06:12 UTC (permalink / raw)

---
 src/bin/psql/describe.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index c7ff55fbd7..32a18becba 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3441,7 +3441,10 @@ describeRoles(const char *pattern, bool verbose, bool showSystem)
 
 	res = PSQLexec(buf.data);
 	if (!res)
+	{
+		termPQExpBuffer(&buf);
 		return false;
+	}
 
 	nrows = PQntuples(res);
 	attr = pg_malloc0((nrows + 1) * sizeof(*attr));
@@ -4800,7 +4803,10 @@ describeOneTSParser(const char *oid, const char *nspname, const char *prsname)
 	res = PSQLexec(buf.data);
 	termPQExpBuffer(&buf);
 	if (!res)
+	{
+		termPQExpBuffer(&title);
 		return false;
+	}
 
 	myopt.nullPrint = NULL;
 	if (nspname)
-- 
2.17.1


--=-=-=--





^ permalink  raw  reply  [nested|flat] 1+ messages in thread


only message in thread

Thread overview: 1+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-07-20 06:12 [PATCH v5 1/1] fix the memory leak in psql describe Japin Li <japinli@hotmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox