diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-06-03 09:23:32 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-06-03 09:24:07 +0300 |
commit | 2517f5c97c68cc284b84e635a44c1d337e31782c (patch) | |
tree | fed041986dccab52f41527505103a786a51301dc /source/blender/imbuf/intern/openexr | |
parent | e695b34505e7c428de2fb5cd695c5f8187d8b34d (diff) |
Fix memory leak loading multi-layer OpenEXR
Diffstat (limited to 'source/blender/imbuf/intern/openexr')
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index fea25544322..e805d3dc25c 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -638,7 +638,7 @@ typedef struct ExrHandle { struct ExrHandle *next, *prev; char name[FILE_MAX]; - IFileStream *ifile_stream; + IStream *ifile_stream; MultiPartInputFile *ifile; OFileStream *ofile_stream; @@ -1496,7 +1496,7 @@ static ExrPass *imb_exr_get_pass(ListBase *lb, char *passname) } /* creates channels, makes a hierarchy and assigns memory to channels */ -static ExrHandle *imb_exr_begin_read_mem(MultiPartInputFile& file, int width, int height) +static ExrHandle *imb_exr_begin_read_mem(IStream &file_stream, MultiPartInputFile &file, int width, int height) { ExrLayer *lay; ExrPass *pass; @@ -1505,7 +1505,9 @@ static ExrHandle *imb_exr_begin_read_mem(MultiPartInputFile& file, int width, in int a; char layname[EXR_TOT_MAXNAME], passname[EXR_TOT_MAXNAME]; + data->ifile_stream = &file_stream; data->ifile = &file; + data->width = width; data->height = height; @@ -1917,7 +1919,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags, char if (is_multi && ((flags & IB_thumbnail) == 0)) { /* only enters with IB_multilayer flag set */ /* constructs channels for reading, allocates memory in channels */ - ExrHandle *handle = imb_exr_begin_read_mem(*file, width, height); + ExrHandle *handle = imb_exr_begin_read_mem(*membuf, *file, width, height); if (handle) { IMB_exr_read_channels(handle); ibuf->userdata = handle; /* potential danger, the caller has to check for this! */ |