Avoid invalid delete call when loading multilayer EXR files with that don't fit the Blender pass naming scheme. If the imb_exr_begin_read_mem function fails reading the EXR (e.g. because of too many channels per pass) it deletes the file internally, leading to segfault on second delete.

This commit is contained in:
Lukas Toenne
2012-04-16 11:57:22 +00:00
parent 798385fa90
commit c509f687ca

View File

@@ -1007,7 +1007,6 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
if (handle) {
IMB_exr_read_channels(handle);
ibuf->userdata= handle; /* potential danger, the caller has to check for this! */
return ibuf;
}
}
else {
@@ -1055,11 +1054,12 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
//
// if (flag & IM_rect)
// IMB_rect_from_float(ibuf);
/* file is no longer needed */
delete file;
}
}
}
delete file;
return(ibuf);
}
catch (const std::exception &exc)