Skip to content

Commit c1d04a4

Browse files
authored
fwrite: avoid deflateEnd() for uninitialized strm (#6858)
When !args.is_gzip, strm is not initialized, so calling deflateEnd() on it is a mistake.
1 parent 11aef2f commit c1d04a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/fwrite.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,8 +927,8 @@ void fwriteMain(fwriteMainArgs args)
927927
}
928928
}
929929
#ifndef NOZLIB
930-
else {
931-
// was unconditionally initialized for zbuffSize, not used for header
930+
else if (args.is_gzip) {
931+
// zstrm initialized for zbuffSize calculation, but not used for header
932932
deflateEnd(&strm);
933933
}
934934
#endif

0 commit comments

Comments
 (0)