On Mon, Mar 30, 2015 at 9:02 AM, Tom Lane <t...@sss.pgh.pa.us> wrote:
> Fix multiple bugs and infelicities in pg_rewind.
>
> Bugs all spotted by Coverity, including wrong realloc() size request
> and memory leaks.  Cosmetic improvements by me.
>
> The usage of the global variable "filemap" here is still pretty awful,
> but at least I got rid of the gratuitous aliasing in several routines
> (which was helping to annoy Coverity, as well as being a bug risk).

Coverity points out that a call to PQclear() in receiveFileChunks of
libpq_fetch.c is missing as the result still leaks resources when
status is PGRES_TUPLES_OK. Please see the patch attached.
-- 
Michael
diff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.c
index 23c971a..e696554 100644
--- a/src/bin/pg_rewind/libpq_fetch.c
+++ b/src/bin/pg_rewind/libpq_fetch.c
@@ -231,6 +231,7 @@ receiveFileChunks(const char *sql)
 				break;
 
 			case PGRES_TUPLES_OK:
+				PQclear(res);
 				continue;		/* final zero-row result */
 
 			default:
-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Reply via email to