summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2014-11-23 13:47:08 -0500
committerAndrew Dunstan <andrew@dunslane.net>2014-11-23 13:47:08 -0500
commit02d5ab6a86aa941109cecd9e6ebe73a67e8bf545 (patch)
tree36c74f4935ecc77d486461332f8c06f7c57b40ac /src/bin
parentb779168ffe330d137b8b4329a7710c8bf1f7e661 (diff)
downloadpostgresql-02d5ab6a86aa941109cecd9e6ebe73a67e8bf545.tar.gz
Fix memory leaks introduced by commit eca2b9b
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/psql/command.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 162fcf1401..4575e2e796 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -2974,7 +2974,10 @@ lookup_function_oid(const char *desc, Oid *foid)
appendPQExpBuffer(query, "::pg_catalog.%s::pg_catalog.oid",
strchr(desc, '(') ? "regprocedure" : "regproc");
if (!lookup_function_echo_hidden(query->data))
+ {
+ destroyPQExpBuffer(query);
return false;
+ }
res = PQexec(pset.db, query->data);
if (PQresultStatus(res) == PGRES_TUPLES_OK && PQntuples(res) == 1)
*foid = atooid(PQgetvalue(res, 0, 0));
@@ -3005,7 +3008,10 @@ get_create_function_cmd(Oid oid, PQExpBuffer buf)
printfPQExpBuffer(query, "SELECT pg_catalog.pg_get_functiondef(%u)", oid);
if (!lookup_function_echo_hidden(query->data))
+ {
+ destroyPQExpBuffer(query);
return false;
+ }
res = PQexec(pset.db, query->data);
if (PQresultStatus(res) == PGRES_TUPLES_OK && PQntuples(res) == 1)
{