NULLing pointers on cleanup

This commit is contained in:
Josh Ware 2014-08-27 19:13:42 +10:00 committed by wiredfool
parent 3da6768a72
commit 7407371deb
3 changed files with 30 additions and 26 deletions

View File

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

View File

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

View File

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