From 973c8efb8b8192b3517bd6d0facbce17fb31e9ca Mon Sep 17 00:00:00 2001 From: Anton Sokolchenko Date: Sat, 12 Apr 2014 18:34:11 +0300 Subject: [PATCH] Fix possible memory leak --- cocos/2d/platform/CCImage.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cocos/2d/platform/CCImage.cpp b/cocos/2d/platform/CCImage.cpp index a502a5b815..b9dfd8f303 100644 --- a/cocos/2d/platform/CCImage.cpp +++ b/cocos/2d/platform/CCImage.cpp @@ -2028,6 +2028,9 @@ bool Image::saveImageToPNG(const std::string& filePath, bool isToRGB) { fclose(fp); png_destroy_write_struct(&png_ptr, &info_ptr); + + free(row_pointers); + row_pointers = nullptr; break; }