From a1ce01f0333368bc662d6731e6f2c3e0de0697e7 Mon Sep 17 00:00:00 2001 From: Christian Kruse Date: Tue, 18 Feb 2014 16:35:29 +0100 Subject: [PATCH] fix: fixed some leaks --- repmgrd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/repmgrd.c b/repmgrd.c index df62b966..e2a50152 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -553,6 +553,9 @@ StandbyMonitor(void) if (PQstatus(primaryConn) != CONNECTION_OK) { + PQfinish(primaryConn); + primaryConn = NULL; + if (local_options.failover == MANUAL_FAILOVER) { log_err(_("We couldn't reconnect to master. Now checking if another node has been promoted.\n")); @@ -774,7 +777,12 @@ do_failover(void) /* if we can't see the node just skip it */ if (PQstatus(nodeConn) != CONNECTION_OK) + { + if (nodeConn != NULL) + PQfinish(nodeConn); + continue; + } visible_nodes++; nodes[i].is_visible = true; @@ -1274,6 +1282,11 @@ terminate(int retval) unlink(pid_file); } + if (progname) + { + free(progname); + } + log_info("Terminating...\n"); exit(retval);