Skip to content

Commit 02d5ab6

Browse files
committed
Fix memory leaks introduced by commit eca2b9b
1 parent b779168 commit 02d5ab6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/bin/psql/command.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,7 +2974,10 @@ lookup_function_oid(const char *desc, Oid *foid)
29742974
appendPQExpBuffer(query, "::pg_catalog.%s::pg_catalog.oid",
29752975
strchr(desc, '(') ? "regprocedure" : "regproc");
29762976
if (!lookup_function_echo_hidden(query->data))
2977+
{
2978+
destroyPQExpBuffer(query);
29772979
return false;
2980+
}
29782981
res = PQexec(pset.db, query->data);
29792982
if (PQresultStatus(res) == PGRES_TUPLES_OK && PQntuples(res) == 1)
29802983
*foid = atooid(PQgetvalue(res, 0, 0));
@@ -3005,7 +3008,10 @@ get_create_function_cmd(Oid oid, PQExpBuffer buf)
30053008
printfPQExpBuffer(query, "SELECT pg_catalog.pg_get_functiondef(%u)", oid);
30063009

30073010
if (!lookup_function_echo_hidden(query->data))
3011+
{
3012+
destroyPQExpBuffer(query);
30083013
return false;
3014+
}
30093015
res = PQexec(pset.db, query->data);
30103016
if (PQresultStatus(res) == PGRES_TUPLES_OK && PQntuples(res) == 1)
30113017
{

0 commit comments

Comments
 (0)