001-Fix-pg_waldump-archive-reader-file-handle-leak-and-r.patch
text/x-patch
Filename: 001-Fix-pg_waldump-archive-reader-file-handle-leak-and-r.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/bin/pg_waldump/archive_waldump.c | 4 | 0 |
| src/bin/pg_waldump/meson.build | 1 | 0 |
diff --git a/src/bin/pg_waldump/archive_waldump.c b/src/bin/pg_waldump/archive_waldump.c
index b078c2d6960..023a549ae9e 100644
--- a/src/bin/pg_waldump/archive_waldump.c
+++ b/src/bin/pg_waldump/archive_waldump.c
@@ -474,7 +474,11 @@ get_archive_wal_entry(const char *fname, XLogDumpPrivate *privateInfo)
entry = ArchivedWAL_lookup(privateInfo->archive_wal_htab, fname);
if (entry != NULL)
+ {
+ if (write_fp != NULL)
+ fclose(write_fp);
return entry;
+ }
/*
* Capture the current entry before calling read_archive_file(),
diff --git a/src/bin/pg_waldump/meson.build b/src/bin/pg_waldump/meson.build
index 5296f21b82c..d2b4bd0c048 100644
--- a/src/bin/pg_waldump/meson.build
+++ b/src/bin/pg_waldump/meson.build
@@ -34,6 +34,7 @@ tests += {
'tests': [
't/001_basic.pl',
't/002_save_fullpage.pl',
+ 't/003_archive.pl',
],
},
}
--
2.43.0