pg_rewind: Close backup_label file descriptor.
authorAndres Freund
Sun, 27 Mar 2016 20:48:31 +0000 (22:48 +0200)
committerAndres Freund
Sun, 27 Mar 2016 20:49:27 +0000 (22:49 +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 cf5f8487f4b2a04b3fbad0a882e81cae11534469..8e172f1618350d30a394a2dba8113d40ce69a634 100644 (file)
@@ -506,6 +506,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();
 }
 
 /*