compressed_pixels is allocated at line 2770, however, when the condition at line 2782 is satisfied and the function returns at line 2785, compressed_pixels (size is 16KB) is not freed and memory leak happens. In addition, the value of compressed_pixels is not passed outside to its caller function when returned at line 2785.
So the condition that this memory leak happens is that MAGICKCORE_ZLIB_DELEGATE is defined, compression type is ZipCompression and deflateInit(&stream,level) is not Z_OK. The size of leaked memory is 16KB.
Prerequisites
Description
memory leak in WritePSDChannel in coders/psd.c
Steps to Reproduce
The critical code snippet is:
https://github.com/ImageMagick/ImageMagick/blob/master/coders/psd.c#L2767
compressed_pixels is allocated at line 2770, however, when the condition at line 2782 is satisfied and the function returns at line 2785, compressed_pixels (size is 16KB) is not freed and memory leak happens. In addition, the value of compressed_pixels is not passed outside to its caller function when returned at line 2785.
So the condition that this memory leak happens is that MAGICKCORE_ZLIB_DELEGATE is defined, compression type is ZipCompression and deflateInit(&stream,level) is not Z_OK. The size of leaked memory is 16KB.
Patch suggestion:
System Configuration
Credit to Bingchang Liu at VARAS of IIE
The text was updated successfully, but these errors were encountered: