mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-01 14:33:40 +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,
|
INCREMENTAL_CODEC_WRITE,
|
||||||
seekable,
|
seekable,
|
||||||
context->fd);
|
context->fd);
|
||||||
|
|
||||||
if (!context->encoder) {
|
if (!context->encoder) {
|
||||||
state->errcode = IMAGING_CODEC_BROKEN;
|
state->errcode = IMAGING_CODEC_BROKEN;
|
||||||
state->state = J2K_STATE_FAILED;
|
state->state = J2K_STATE_FAILED;
|
||||||
|
@ -576,19 +575,19 @@ int
|
||||||
ImagingJpeg2KEncodeCleanup(ImagingCodecState state) {
|
ImagingJpeg2KEncodeCleanup(ImagingCodecState state) {
|
||||||
JPEG2KENCODESTATE *context = (JPEG2KENCODESTATE *)state->context;
|
JPEG2KENCODESTATE *context = (JPEG2KENCODESTATE *)state->context;
|
||||||
|
|
||||||
//if (context->quality_layers)
|
if (context->quality_layers && context->encoder)
|
||||||
// Py_DECREF(context->quality_layers);
|
Py_DECREF(context->quality_layers);
|
||||||
|
|
||||||
//if (context->error_msg)
|
if (context->error_msg)
|
||||||
// free ((void *)context->error_msg);
|
free ((void *)context->error_msg);
|
||||||
|
|
||||||
//context->error_msg = NULL;
|
context->error_msg = NULL;
|
||||||
|
|
||||||
//if (context->encoder)
|
if (context->encoder)
|
||||||
// ImagingIncrementalCodecDestroy(context->encoder);
|
ImagingIncrementalCodecDestroy(context->encoder);
|
||||||
|
|
||||||
/* Prevent multiple calls to ImagingIncrementalCodecDestroy */
|
/* Prevent multiple calls to ImagingIncrementalCodecDestroy */
|
||||||
//context->encoder = NULL;
|
context->encoder = NULL;
|
||||||
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user