Don't Py_DECREF context->quality_layers if there is no encoder

This commit is contained in:
Josh Ware 2014-08-27 19:54:33 +10:00 committed by wiredfool
parent e4e1f5c2d4
commit dd221d9ec0

View File

@ -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;