Module: wine Branch: master Commit: f0707f17577db9675d49a829d4cb6b43596e8505 URL: https://gitlab.winehq.org/wine/wine/-/commit/f0707f17577db9675d49a829d4cb6b4...
Author: Danyil Blyschak dblyschak@codeweavers.com Date: Thu Jun 13 12:52:19 2024 -0500
opcservices: Check for memory allocation failure before deflating.
---
dlls/opcservices/compress.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/opcservices/compress.c b/dlls/opcservices/compress.c index 841c674c26c..78b38f8437a 100644 --- a/dlls/opcservices/compress.c +++ b/dlls/opcservices/compress.c @@ -202,6 +202,7 @@ static void compress_write_content(struct zip_archive *archive, IStream *content LARGE_INTEGER move; ULONG num_read; HRESULT hr; + int init_ret;
data_desc->crc32 = RtlComputeCrc32(0, NULL, 0); move.QuadPart = 0; @@ -232,7 +233,8 @@ static void compress_write_content(struct zip_archive *archive, IStream *content memset(&z_str, 0, sizeof(z_str)); z_str.zalloc = zalloc; z_str.zfree = zfree; - deflateInit2(&z_str, level, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); + if ((init_ret = deflateInit2(&z_str, level, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY)) != Z_OK) + WARN("Failed to allocate memory in deflateInit2, ret %d.\n", init_ret);
do {