mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Free zstream memory with deflateEnd before reinitializing it.
This commit is contained in:
parent
6bdea98992
commit
ed8aab4d85
@ -678,6 +678,8 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||
png_ptr->zlib_text_method = 8;
|
||||
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
|
||||
|
||||
/* Free memory from previously opened zstream */
|
||||
deflateEnd(&png_ptr->zstream);
|
||||
/* Initialize the zlib compressor */
|
||||
ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
|
||||
png_ptr->zlib_method, png_ptr->zlib_window_bits,
|
||||
@ -776,6 +778,9 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
int ret;
|
||||
unsigned int z_cmf; /* zlib compression method and flags */
|
||||
|
||||
/* Free memory from previously opened zstream */
|
||||
deflateEnd(&png_ptr->zstream);
|
||||
|
||||
ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
|
||||
png_ptr->zlib_method, png_ptr->zlib_window_bits,
|
||||
png_ptr->zlib_mem_level, png_ptr->zlib_strategy);
|
||||
|
Loading…
x
Reference in New Issue
Block a user