fix memory leak when reading invalid tiff - refs #1783

This commit is contained in:
Dane Springmeyer 2013-04-09 19:08:50 -07:00
parent 16e2e8a06f
commit 771cbb11bf

View file

@ -118,11 +118,12 @@ void tiff_reader::on_error(const char* /*module*/, const char* fmt, va_list argp
void tiff_reader::init() void tiff_reader::init()
{ {
// TODO: error handling // TODO: error handling
TIFFSetWarningHandler(0);
TIFFSetErrorHandler(on_error);
TIFF* tif = load_if_exists(file_name_); TIFF* tif = load_if_exists(file_name_);
if (!tif) throw image_reader_exception( std::string("Can't load tiff file: '") + file_name_ + "'"); if (!tif) throw image_reader_exception( std::string("Can't load tiff file: '") + file_name_ + "'");
TIFFSetWarningHandler(0);
TIFFSetErrorHandler(on_error);
char msg[1024]; char msg[1024];
if (TIFFRGBAImageOK(tif,msg)) if (TIFFRGBAImageOK(tif,msg))