Fix double free in standby clone

This commit is contained in:
Greg Smith
2011-02-23 07:26:39 -05:00
parent 2675101330
commit 9c6288993b

View File

@@ -1035,6 +1035,10 @@ stop_backup:
log_info(_("%s requires primary to keep WAL files %s until at least %s\n"),
progname, first_wal_segment, last_wal_segment);
/* Finished with the database connection now */
PQclear(res);
PQfinish(conn);
/*
* Only free the first_wal_segment since it was copied out of the
* pqresult.
@@ -1042,9 +1046,6 @@ stop_backup:
free(first_wal_segment);
first_wal_segment = NULL;
PQclear(res);
PQfinish(conn);
/* If the rsync failed then exit */
if (r != 0)
exit(ERR_BAD_RSYNC);
@@ -1064,9 +1065,6 @@ stop_backup:
/* Finally, write the recovery.conf file */
create_recovery_file(runtime_options.dest_dir, NULL);
PQclear(res);
PQfinish(conn);
/*
* We don't start the service yet because we still may want to
* move the directory