Commit bcc87b6b authored by Tom Lane's avatar Tom Lane

Fix assorted memory leaks.

Per Coverity (not that any of these are so non-obvious that they should not
have been caught before commit).  The extent of leakage is probably minor
to unnoticeable, but a leak is a leak.  Back-patch as necessary.

Michael Paquier
parent 3ed26e5f
...@@ -414,6 +414,7 @@ DropReplicationSlot(PGconn *conn, const char *slot_name) ...@@ -414,6 +414,7 @@ DropReplicationSlot(PGconn *conn, const char *slot_name)
return false; return false;
} }
destroyPQExpBuffer(query);
PQclear(res); PQclear(res);
return true; return true;
} }
......
...@@ -6660,6 +6660,7 @@ getTransforms(Archive *fout, int *numTransforms) ...@@ -6660,6 +6660,7 @@ getTransforms(Archive *fout, int *numTransforms)
appendPQExpBuffer(&namebuf, "%s %s", appendPQExpBuffer(&namebuf, "%s %s",
typeInfo->dobj.name, lanname); typeInfo->dobj.name, lanname);
transforminfo[i].dobj.name = namebuf.data; transforminfo[i].dobj.name = namebuf.data;
free(lanname);
} }
PQclear(res); PQclear(res);
...@@ -15735,6 +15736,7 @@ getExtensionMembership(Archive *fout, DumpOptions *dopt, ExtensionInfo extinfo[] ...@@ -15735,6 +15736,7 @@ getExtensionMembership(Archive *fout, DumpOptions *dopt, ExtensionInfo extinfo[]
addObjectDependency(&contable->dataObj->dobj, addObjectDependency(&contable->dataObj->dobj,
reftable->dataObj->dobj.dumpId); reftable->dataObj->dobj.dumpId);
} }
PQclear(res);
destroyPQExpBuffer(query); destroyPQExpBuffer(query);
} }
......
...@@ -81,6 +81,7 @@ libpqConnect(const char *connstr) ...@@ -81,6 +81,7 @@ libpqConnect(const char *connstr)
/* /*
* Runs a query that returns a single value. * Runs a query that returns a single value.
* The result should be pg_free'd after use.
*/ */
static char * static char *
run_simple_query(const char *sql) run_simple_query(const char *sql)
...@@ -123,6 +124,8 @@ libpqGetCurrentXlogInsertLocation(void) ...@@ -123,6 +124,8 @@ libpqGetCurrentXlogInsertLocation(void)
result = ((uint64) hi) << 32 | lo; result = ((uint64) hi) << 32 | lo;
pg_free(val);
return result; return result;
} }
...@@ -201,6 +204,7 @@ libpqProcessFileList(void) ...@@ -201,6 +204,7 @@ libpqProcessFileList(void)
process_source_file(path, type, filesize, link_target); process_source_file(path, type, filesize, link_target);
} }
PQclear(res);
} }
/*---- /*----
......
...@@ -412,6 +412,7 @@ vacuum_one_database(const char *dbname, vacuumingOptions *vacopts, ...@@ -412,6 +412,7 @@ vacuum_one_database(const char *dbname, vacuumingOptions *vacopts,
concurrentCons = ntups; concurrentCons = ntups;
if (concurrentCons <= 1) if (concurrentCons <= 1)
parallel = false; parallel = false;
PQclear(res);
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment