From: Umar Date: Thu, 8 Feb 2018 18:05:46 +0000 (+0000) Subject: Fixed Memory Leakage in gif loading. X-Git-Tag: dali_1.3.12~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=bd7b97a542e043b35ace3a6134b4be151a1d10f5 Fixed Memory Leakage in gif loading. Change-Id: I4d3daedca9ac5b6d72859693720f8b3ae1c8e14d --- diff --git a/dali/devel-api/adaptor-framework/gif-loading.cpp b/dali/devel-api/adaptor-framework/gif-loading.cpp index 2d5094b..3d8e785 100644 --- a/dali/devel-api/adaptor-framework/gif-loading.cpp +++ b/dali/devel-api/adaptor-framework/gif-loading.cpp @@ -1042,7 +1042,7 @@ open_file: FlushFrames( animated, prop.w, prop.h, thisFrame, previousFrame, lastPreservedFrame ); } - // if we hve a frame BUT the image is not animated... different + // if we have a frame BUT the image is not animated. different // path else if( (thisFrame) && (!thisFrame->data) && (!animated.animated) ) { @@ -1152,6 +1152,17 @@ public: munmap( loaderInfo.fileData.globalMap , loaderInfo.fileData.length ); loaderInfo.fileData.globalMap = nullptr; } + + // Delete all image frames + for( auto &&frame : loaderInfo.animated.frames ) + { + if( frame.data != nullptr ) + { + // De-allocate memory of the frame data. + delete[] frame.data; + frame.data = nullptr; + } + } } std::string mUrl;