From 9515e7ff78facd349ba3d86a637be71acaccc02e Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 28 May 2026 19:31:28 +0200 Subject: bzip2recover: bsClose bsWr on early EOF When getting an early EOF bsWr is never closed so any buffered output is leaked and never flushed out to the file. --- bzip2recover.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bzip2recover.c b/bzip2recover.c index 26a9b9d..28d4a05 100644 --- a/bzip2recover.c +++ b/bzip2recover.c @@ -441,7 +441,12 @@ Int32 main ( Int32 argc, Char** argv ) wrBlock = 0; while (True) { b = bsGetBit(bsIn); - if (b == 2) break; + if (b == 2) { + if (outFile != NULL) { + bsClose(bsWr); + } + break; + } buffHi = (buffHi << 1) | (buffLo >> 31); buffLo = (buffLo << 1) | (b & 1); if (bitsRead == 47+rbStart[wrBlock]) -- cgit v1.2.3-55-g6feb