Fix multiple bugs and infelicities in pg_rewind.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: c67f366fa9f748257861ee233b47b80eb5ffa857
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2015-03-30T00:02:14Z
Releases: 9.5.0
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).

Files

PathChange+/−
src/bin/pg_rewind/filemap.c modified +32 −28
src/bin/pg_rewind/filemap.h modified +9 −15
src/bin/pg_rewind/libpq_fetch.c modified +4 −0
src/bin/pg_rewind/pg_rewind.c modified +1 −1