pg_receivewal: Fix resource leaks and error reporting during cleanup Failures while finalizing LZ4 compression or writing the final compressed data could leak a file descriptor and memory. Without --no-loop, repeated failures across reconnects could accumulate these resources.
This happened because dir_close() returned immediately on these failures, skipping the code that closes the file and releases its associated resources. Fix this by closing the file and executing the common cleanup code before returning. Backpatch to all supported versions. Author: Fujii Masao <[email protected]> Reviewed-by: Chao Li <[email protected]> Reviewed-by: Michael Paquier <[email protected]> Reviewed-by: Xuneng Zhou <[email protected]> Discussion: https://postgr.es/m/CAHGQGwHfCrEogr6=wr0nckqevaj9a3hbqqrjt9ijryo7ejf...@mail.gmail.com Backpatch-through: 15 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f753bbf57809fc969efd17b3fd6f68e1da3ff979 Modified Files -------------- src/bin/pg_basebackup/walmethods.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
