Fix walsender error cleanup code

In commit 850196b610d2 I (Álvaro) failed to handle the case of walsender
shutting down on an error before setting up its 'xlogreader' pointer;
the error handling code dereferences the pointer, causing a crash.
Fix by testing the pointer before trying to dereference it.

Kyotaro authored the code fix; I adopted Nathan's test case to be used
by the TAP tests and added the necessary PostgresNode change.

Reported-by: Nathan Bossart <[email protected]>
Author: Kyotaro Horiguchi <[email protected]>
Author: Álvaro Herrera <[email protected]>
Discussion: https://postgr.es/m/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1d3743023ef8fa665902e791b0d52e9a1ab419cb

Modified Files
--------------
src/backend/replication/walsender.c         |  2 +-
src/test/perl/PostgresNode.pm               | 17 +++++++++++++++--
src/test/recovery/t/006_logical_decoding.pl | 13 +++++++++++--
3 files changed, 27 insertions(+), 5 deletions(-)

Reply via email to