diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-02-20 17:48:15 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-02-20 19:56:56 +0300 |
commit | 95180a46ed019205c7bb7449e1d92010fe172316 (patch) | |
tree | 46a9d34f09f83b397797ed6961e8797635c1ae37 | |
parent | 4dd406c7b7bb26742a3d13f950b28c9b071766a9 (diff) |
Fix memory leak when saving OpenEXR half file fails.
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 40b5a1a914c..47fa4c1de0c 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -422,14 +422,14 @@ static bool imb_save_openexr_half( OutputFile file(file_stream, header); /* we store first everything in half array */ - RGBAZ *pixels = new RGBAZ[height * width * totviews]; + std::vector<RGBAZ> pixels(height * width * totviews); int xstride = sizeof(RGBAZ); int ystride = xstride * width; for (view_id = 0; view_id < totviews; view_id ++) { ImBuf *view_ibuf = is_multiview ? getbuffer(ibuf->userdata, view_id) : ibuf; const size_t offset = view_id * width * height; - RGBAZ *to = pixels + offset; + RGBAZ *to = &pixels[offset]; /* TODO (dfelinto) * In some cases we get NULL ibufs, it needs investigation, meanwhile prevent crash @@ -487,8 +487,6 @@ static bool imb_save_openexr_half( file.setFrameBuffer(frameBuffer); file.writePixels(height); - - delete[] pixels; } catch (const std::exception& exc) { |