Fix multiple bugs and infelicities in pg_rewind.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 30 Mar 2015 00:02:14 +0000 (20:02 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 30 Mar 2015 00:02:14 +0000 (20:02 -0400)
commitc67f366fa9f748257861ee233b47b80eb5ffa857
treec76f6288f45e7d9979b1294cda0df01684f75ad3
parente4cbfd673d530a3e841db26a74f22e11a991205a
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).
src/bin/pg_rewind/filemap.c
src/bin/pg_rewind/filemap.h
src/bin/pg_rewind/libpq_fetch.c
src/bin/pg_rewind/pg_rewind.c