pg_rewind: Close backup_label file descriptor.
authorAndres Freund <[email protected]>
Sun, 27 Mar 2016 20:48:31 +0000 (22:48 +0200)
committerAndres Freund <[email protected]>
Sun, 27 Mar 2016 20:48:31 +0000 (22:48 +0200)
This was a relatively harmless leak, as createBackupLabel() is only
called once per pg_rewind invocation.

Author: Michael Paquier
Reported-By: Michael Paquier
Discussion: CAB7nPqRnOw30gOXe2_SPLjh37bgm4V+txbYAPwoXb97nGQ297w@mail.gmail.com
Backpatch: 9.5, where pg_rewind was introduced

src/bin/pg_rewind/pg_rewind.c

index 96a42f8e331006694123d0bdb7a8069b5b4a7420..c5589b9bb3a4e7e7709e9995d3abaeaf8c3f5a9d 100644 (file)
@@ -584,6 +584,7 @@ createBackupLabel(XLogRecPtr startpoint, TimeLineID starttli, XLogRecPtr checkpo
        /* TODO: move old file out of the way, if any. */
        open_target_file("backup_label", true);         /* BACKUP_LABEL_FILE */
        write_target_range(buf, 0, len);
+       close_target_file();
 }
 
 /*