diff --git a/repmgrd.c b/repmgrd.c index c82ddd73..3798171c 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -180,6 +180,10 @@ main(int argc, char **argv) MonitorCheck(); } + /* Prevent a double-free */ + if (primaryConn == myLocalConn) + myLocalConn = NULL; + /* close the connection to the database and cleanup */ CloseConnections();