Skip to content

Commit

Permalink
Merge pull request #2037 from Unity-Technologies/2021.3/fix-uum-72456…
Browse files Browse the repository at this point in the history
…-zlib-ng-crash

[2021.3] Correct the selection of alloc/free functions for zlib.
  • Loading branch information
scott-ferguson-unity committed Jun 25, 2024
2 parents ffd2e28 + 05a6e0e commit 33befe7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions support/zlib-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ CreateZStream (gint compress, guchar gzip, read_write_func func, void *gchandle)
return NULL;

z = z_new0 (z_stream);
z->zalloc = z_alloc;
z->zfree = z_free;
if (compress) {
retval = deflateInit2 (z, Z_DEFAULT_COMPRESSION, Z_DEFLATED, gzip ? 31 : -15, 8, Z_DEFAULT_STRATEGY);
} else {
Expand All @@ -86,8 +88,6 @@ CreateZStream (gint compress, guchar gzip, read_write_func func, void *gchandle)
free (z);
return NULL;
}
z->zalloc = z_alloc;
z->zfree = z_free;
result = z_new0 (ZStream);
result->stream = z;
result->func = func;
Expand Down

0 comments on commit 33befe7

Please sign in to comment.