Update ImageReaderSource.cpp

Removing memory leak in Ref<LuminanceSource> ImageReaderSource::create(string const& filename).
This commit is contained in:
Danil Dulin 2015-07-10 07:30:14 +03:00
parent bc1f054246
commit f41221926b

View File

@ -75,6 +75,7 @@ Ref<LuminanceSource> ImageReaderSource::create(string const& filename) {
char *buffer = reinterpret_cast<char*>(jpgd::decompress_jpeg_image_from_file( char *buffer = reinterpret_cast<char*>(jpgd::decompress_jpeg_image_from_file(
filename.c_str(), &width, &height, &comps, 4)); filename.c_str(), &width, &height, &comps, 4));
image = zxing::ArrayRef<char>(buffer, 4 * width * height); image = zxing::ArrayRef<char>(buffer, 4 * width * height);
free(buffer);
} }
if (!image) { if (!image) {
ostringstream msg; ostringstream msg;