[Bf-blender-cvs] [d4b5dd3] master: ImBuf: Fixes for openexr images

Sergey Sharybin noreply at git.blender.org
Wed Jul 29 12:02:50 CEST 2015


Commit: d4b5dd31a360313734f78a112daf4fd8f26fceb5
Author: Sergey Sharybin
Date:   Wed Jul 29 11:59:29 2015 +0200
Branches: master
https://developer.blender.org/rBd4b5dd31a360313734f78a112daf4fd8f26fceb5

ImBuf: Fixes for openexr images

- Fixed crash loading multilayer EXR
- Fixed another memory leak loading multilayer EXR

===================================================================

M	source/blender/imbuf/intern/openexr/openexr_api.cpp

===================================================================

diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 33555f0..e3c0273 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -1560,7 +1560,6 @@ static ExrHandle *imb_exr_begin_read_mem(IStream &file_stream, MultiPartInputFil
 	std::vector<MultiViewChannelName> channels;
 	GetChannelsInMultiPartFile(*data->ifile, channels);
 
-	data->multiView = new StringVector();
 	imb_exr_get_views(*data->ifile, *data->multiView);
 
 	for (size_t i = 0; i < channels.size(); i++) {
@@ -2048,13 +2047,19 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, size_t size, int flags,
 						}
 					}
 
+					/* file is no longer needed */
+					delete membuf;
+					delete file;
 				}
 			}
+			else {
+				delete membuf;
+				delete file;
+			}
+
 			if (flags & IB_alphamode_detect)
 				ibuf->flags |= IB_alphamode_premul;
 		}
-		delete file;
-		delete membuf;
 		return(ibuf);
 	}
 	catch (const std::exception& exc)




More information about the Bf-blender-cvs mailing list