From 1b5ad743b551b4db5bc72be847887541d0a8fd85 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 11 May 2020 13:52:10 +0900 Subject: [PATCH] standby clone: explicitly set closed connection pointers to NULL We omitted to do this with the connections used when checking the system identifier, which means libpq calls by the teardown function using the pointer risk using unallocated memory. Addresses issue reported in GitHub #644. --- repmgr-action-standby.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 3d71e5e8..7e787ee1 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -5627,6 +5627,7 @@ check_source_server() { uint64 test_system_identifier = system_identifier(cell->node_info->conn); PQfinish(cell->node_info->conn); + cell->node_info->conn = NULL; if (test_system_identifier != UNKNOWN_SYSTEM_IDENTIFIER) { @@ -5650,6 +5651,7 @@ check_source_server() else { PQfinish(cell->node_info->conn); + cell->node_info->conn = NULL; } } clear_node_info_list(&all_nodes);