diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-06-03 09:07:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-06-03 09:24:00 +0300 |
commit | e695b34505e7c428de2fb5cd695c5f8187d8b34d (patch) | |
tree | 005df9196d551618112684ff9a288c9e9425d391 /source/blender/imbuf/intern/openexr | |
parent | 52795932a7f7890a32e22605594f79f3351a892d (diff) |
Fix memory leak loading single-layer OpenEXR
Internal EXR API specifically avoids freeing non-file streams.
Diffstat (limited to 'source/blender/imbuf/intern/openexr')
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 05a4c87a697..fea25544322 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1856,6 +1856,7 @@ static bool imb_exr_is_multi(MultiPartInputFile& file) struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]) { struct ImBuf *ibuf = NULL; + Mem_IStream *membuf = NULL; MultiPartInputFile *file = NULL; if (imb_is_a_openexr(mem) == 0) return(NULL); @@ -1864,8 +1865,9 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags, char try { - Mem_IStream *membuf = new Mem_IStream(mem, size); bool is_multi; + + membuf = new Mem_IStream(mem, size); file = new MultiPartInputFile(*membuf); Box2i dw = file->header(0).dataWindow(); @@ -1999,6 +2001,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags, char } /* file is no longer needed */ + delete membuf; delete file; } } @@ -2013,6 +2016,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags, char std::cerr << exc.what() << std::endl; if (ibuf) IMB_freeImBuf(ibuf); delete file; + delete membuf; return (0); } |