summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/pg_basebackup/streamutil.c1
-rw-r--r--src/bin/pg_dump/pg_dump.c2
-rw-r--r--src/bin/pg_rewind/libpq_fetch.c8
-rw-r--r--src/bin/scripts/vacuumdb.c7
4 files changed, 13 insertions, 5 deletions
diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c
index a5cad350f8a..91f919c34cd 100644
--- a/src/bin/pg_basebackup/streamutil.c
+++ b/src/bin/pg_basebackup/streamutil.c
@@ -414,6 +414,7 @@ DropReplicationSlot(PGconn *conn, const char *slot_name)
return false;
}
+ destroyPQExpBuffer(query);
PQclear(res);
return true;
}
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 1258cef6bc8..0e036b84aa8 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -6660,6 +6660,7 @@ getTransforms(Archive *fout, int *numTransforms)
appendPQExpBuffer(&namebuf, "%s %s",
typeInfo->dobj.name, lanname);
transforminfo[i].dobj.name = namebuf.data;
+ free(lanname);
}
PQclear(res);
@@ -15735,6 +15736,7 @@ getExtensionMembership(Archive *fout, DumpOptions *dopt, ExtensionInfo extinfo[]
addObjectDependency(&contable->dataObj->dobj,
reftable->dataObj->dobj.dumpId);
}
+ PQclear(res);
destroyPQExpBuffer(query);
}
diff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.c
index 05aa133cf36..1979fbcb8a5 100644
--- a/src/bin/pg_rewind/libpq_fetch.c
+++ b/src/bin/pg_rewind/libpq_fetch.c
@@ -69,7 +69,7 @@ libpqConnect(const char *connstr)
pg_free(str);
/*
- * Also check that full_page_writes is enabled. We can get torn pages if
+ * Also check that full_page_writes is enabled. We can get torn pages if
* a page is modified while we read it with pg_read_binary_file(), and we
* rely on full page images to fix them.
*/
@@ -81,6 +81,7 @@ libpqConnect(const char *connstr)
/*
* Runs a query that returns a single value.
+ * The result should be pg_free'd after use.
*/
static char *
run_simple_query(const char *sql)
@@ -123,6 +124,8 @@ libpqGetCurrentXlogInsertLocation(void)
result = ((uint64) hi) << 32 | lo;
+ pg_free(val);
+
return result;
}
@@ -201,6 +204,7 @@ libpqProcessFileList(void)
process_source_file(path, type, filesize, link_target);
}
+ PQclear(res);
}
/*----
@@ -296,7 +300,7 @@ receiveFileChunks(const char *sql)
if (PQgetisnull(res, 0, 2))
{
pg_log(PG_DEBUG,
- "received NULL chunk for file \"%s\", file has been deleted\n",
+ "received NULL chunk for file \"%s\", file has been deleted\n",
filename);
pg_free(filename);
PQclear(res);
diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c
index ca6d0036832..7e72db1edf7 100644
--- a/src/bin/scripts/vacuumdb.c
+++ b/src/bin/scripts/vacuumdb.c
@@ -393,9 +393,9 @@ vacuum_one_database(const char *dbname, vacuumingOptions *vacopts,
for (i = 0; i < ntups; i++)
{
appendPQExpBufferStr(&buf,
- fmtQualifiedId(PQserverVersion(conn),
- PQgetvalue(res, i, 1),
- PQgetvalue(res, i, 0)));
+ fmtQualifiedId(PQserverVersion(conn),
+ PQgetvalue(res, i, 1),
+ PQgetvalue(res, i, 0)));
simple_string_list_append(&dbtables, buf.data);
resetPQExpBuffer(&buf);
@@ -412,6 +412,7 @@ vacuum_one_database(const char *dbname, vacuumingOptions *vacopts,
concurrentCons = ntups;
if (concurrentCons <= 1)
parallel = false;
+ PQclear(res);
}
/*