Fix memory leak

This commit is contained in:
Anton Sokolchenko 2014-04-12 18:47:00 +03:00
parent 6feef5fa55
commit a9ccb812ed
1 changed files with 8 additions and 1 deletions

View File

@ -804,7 +804,14 @@ bool Image::initWithJpgData(const unsigned char * data, ssize_t dataLen)
_dataLen = cinfo.output_width*cinfo.output_height*cinfo.output_components;
_data = static_cast<unsigned char*>(malloc(_dataLen * sizeof(unsigned char)));
CC_BREAK_IF(! _data);
if(!_data)
{
if (row_pointers != nullptr)
{
free(row_pointers);
}
break;
}
/* now actually read the jpeg into the raw buffer */
/* read one scan line at a time */