mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-10 00:20:57 +03:00
NULLing pointers on cleanup
This commit is contained in:
parent
3da6768a72
commit
7407371deb
|
@ -473,7 +473,7 @@ def _save(im, fp, tile, bufsize=0):
|
||||||
break
|
break
|
||||||
if s < 0:
|
if s < 0:
|
||||||
raise IOError("encoder error %d when writing image file" % s)
|
raise IOError("encoder error %d when writing image file" % s)
|
||||||
#e.cleanup()
|
e.cleanup()
|
||||||
else:
|
else:
|
||||||
# slight speedup: compress to real file object
|
# slight speedup: compress to real file object
|
||||||
for e, b, o, a in tile:
|
for e, b, o, a in tile:
|
||||||
|
@ -484,7 +484,7 @@ def _save(im, fp, tile, bufsize=0):
|
||||||
s = e.encode_to_file(fh, bufsize)
|
s = e.encode_to_file(fh, bufsize)
|
||||||
if s < 0:
|
if s < 0:
|
||||||
raise IOError("encoder error %d when writing image file" % s)
|
raise IOError("encoder error %d when writing image file" % s)
|
||||||
#e.cleanup()
|
e.cleanup()
|
||||||
try:
|
try:
|
||||||
fp.flush()
|
fp.flush()
|
||||||
except: pass
|
except: pass
|
||||||
|
|
|
@ -797,6 +797,8 @@ ImagingJpeg2KDecodeCleanup(ImagingCodecState state) {
|
||||||
if (context->error_msg)
|
if (context->error_msg)
|
||||||
free ((void *)context->error_msg);
|
free ((void *)context->error_msg);
|
||||||
|
|
||||||
|
context->error_msg = NULL;
|
||||||
|
|
||||||
if (context->decoder)
|
if (context->decoder)
|
||||||
ImagingIncrementalCodecDestroy(context->decoder);
|
ImagingIncrementalCodecDestroy(context->decoder);
|
||||||
|
|
||||||
|
|
|
@ -582,6 +582,8 @@ ImagingJpeg2KEncodeCleanup(ImagingCodecState state) {
|
||||||
if (context->error_msg)
|
if (context->error_msg)
|
||||||
free ((void *)context->error_msg);
|
free ((void *)context->error_msg);
|
||||||
|
|
||||||
|
context->error_msg = NULL;
|
||||||
|
|
||||||
if (context->encoder)
|
if (context->encoder)
|
||||||
ImagingIncrementalCodecDestroy(context->encoder);
|
ImagingIncrementalCodecDestroy(context->encoder);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user