aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2026-05-28 19:31:28 +0200
committerMark Wielaard <mark@klomp.org>2026-06-11 23:19:53 +0200
commit9515e7ff78facd349ba3d86a637be71acaccc02e (patch)
tree4319ef4aee4a61f7020017186c8587fc4fe3802a
parent42cc1a9559e02844ff4b9698b838ec73ea56cc1a (diff)
downloadbzip2-9515e7ff78facd349ba3d86a637be71acaccc02e.tar.gz
bzip2-9515e7ff78facd349ba3d86a637be71acaccc02e.tar.bz2
bzip2-9515e7ff78facd349ba3d86a637be71acaccc02e.zip
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.
-rw-r--r--bzip2recover.c7
1 files changed, 6 insertions, 1 deletions
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 )
441 wrBlock = 0; 441 wrBlock = 0;
442 while (True) { 442 while (True) {
443 b = bsGetBit(bsIn); 443 b = bsGetBit(bsIn);
444 if (b == 2) break; 444 if (b == 2) {
445 if (outFile != NULL) {
446 bsClose(bsWr);
447 }
448 break;
449 }
445 buffHi = (buffHi << 1) | (buffLo >> 31); 450 buffHi = (buffHi << 1) | (buffLo >> 31);
446 buffLo = (buffLo << 1) | (b & 1); 451 buffLo = (buffLo << 1) | (b & 1);
447 if (bitsRead == 47+rbStart[wrBlock]) 452 if (bitsRead == 47+rbStart[wrBlock])