diff --git a/cocos/2d/platform/CCImage.cpp b/cocos/2d/platform/CCImage.cpp index 4a991c8939..324c525730 100644 --- a/cocos/2d/platform/CCImage.cpp +++ b/cocos/2d/platform/CCImage.cpp @@ -2023,7 +2023,7 @@ bool Image::saveImageToPNG(const std::string& filePath, bool isToRGB) { if (isToRGB) { - unsigned char *pTempData = static_cast(malloc(_width * _height * 3 * sizeof(unsigned char*))); + unsigned char *pTempData = static_cast(malloc(_width * _height * 3 * sizeof(unsigned char))); if (nullptr == pTempData) { fclose(fp);