Fix handling of global PGconn variables in repmgrd

Don't call PQfinish before calling terminate(), elsewhere always
set to NULL after calling PQfinish().

This fixes GitHub #182.
This commit is contained in:
Ian Barwick
2016-06-21 17:30:22 +09:00
parent dd5b6f9f12
commit c16ab3c889

View File

@@ -1195,7 +1195,6 @@ do_master_failover(void)
{
log_err(_("unable to retrieve node records: %s\n"), PQerrorMessage(my_local_conn));
PQclear(res);
PQfinish(my_local_conn);
terminate(ERR_DB_QUERY);
}
@@ -1569,12 +1568,12 @@ do_master_failover(void)
log_notice(_("Original master reappeared before this standby was promoted - no action taken\n"));
PQfinish(master_conn);
master_conn = NULL;
/* no failover occurred but we'll want to restart connections */
failover_done = true;
return;
}
PQfinish(my_local_conn);
}
log_err(_("promote command failed. You could check and try it manually.\n"));
@@ -2446,6 +2445,8 @@ get_node_info(PGconn *conn, char *cluster, int node_id)
errmsg.data);
PQfinish(conn);
conn = NULL;
terminate(ERR_DB_QUERY);
}