Skip to content

Commit bbc8a18

Browse files
Also don't assign mystream unless is_gzip
1 parent a99edcb commit bbc8a18

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/fwrite.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,10 +984,11 @@ void fwriteMain(fwriteMainArgs args)
984984
#ifndef NOZLIB
985985
size_t mylen = 0;
986986
int mycrc = 0;
987-
z_stream *mystream = &thread_streams[me];
987+
z_stream *mystream = NULL;
988988
void *myzBuff = NULL;
989989
size_t myzbuffUsed = 0;
990990
if (args.is_gzip) {
991+
mystream = &thread_streams[me];
991992
myzBuff = zbuffPool + me * zbuffSize;
992993
if (init_stream(mystream) != Z_OK) { // this should be thread safe according to zlib documentation
993994
failed = true; // # nocov

0 commit comments

Comments
 (0)