mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Don't Py_DECREF context->quality_layers if there is no encoder
This commit is contained in:
parent
e4e1f5c2d4
commit
dd221d9ec0
|
@ -555,7 +555,6 @@ ImagingJpeg2KEncode(Imaging im, ImagingCodecState state, UINT8 *buf, int bytes)
|
|||
INCREMENTAL_CODEC_WRITE,
|
||||
seekable,
|
||||
context->fd);
|
||||
|
||||
if (!context->encoder) {
|
||||
state->errcode = IMAGING_CODEC_BROKEN;
|
||||
state->state = J2K_STATE_FAILED;
|
||||
|
@ -576,19 +575,19 @@ int
|
|||
ImagingJpeg2KEncodeCleanup(ImagingCodecState state) {
|
||||
JPEG2KENCODESTATE *context = (JPEG2KENCODESTATE *)state->context;
|
||||
|
||||
//if (context->quality_layers)
|
||||
// Py_DECREF(context->quality_layers);
|
||||
if (context->quality_layers && context->encoder)
|
||||
Py_DECREF(context->quality_layers);
|
||||
|
||||
//if (context->error_msg)
|
||||
// free ((void *)context->error_msg);
|
||||
if (context->error_msg)
|
||||
free ((void *)context->error_msg);
|
||||
|
||||
//context->error_msg = NULL;
|
||||
context->error_msg = NULL;
|
||||
|
||||
//if (context->encoder)
|
||||
// ImagingIncrementalCodecDestroy(context->encoder);
|
||||
if (context->encoder)
|
||||
ImagingIncrementalCodecDestroy(context->encoder);
|
||||
|
||||
/* Prevent multiple calls to ImagingIncrementalCodecDestroy */
|
||||
//context->encoder = NULL;
|
||||
/* Prevent multiple calls to ImagingIncrementalCodecDestroy */
|
||||
context->encoder = NULL;
|
||||
|
||||
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user