diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-07-12 16:25:51 -0400 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-07-12 16:26:18 -0400 |
| commit | 0e78a610f24463f64d8a03b39f06e995581c923a (patch) | |
| tree | 5b78dcfff8853a8312ff5b600f62ab4e50734950 /src/bin/pg_rewind/libpq_fetch.c | |
| parent | 1884708e25c444eb9de6b0665b94c268bab25689 (diff) | |
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
Diffstat (limited to 'src/bin/pg_rewind/libpq_fetch.c')
| -rw-r--r-- | src/bin/pg_rewind/libpq_fetch.c | 8 |
1 files changed, 6 insertions, 2 deletions
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); |
