Skip to content

Commit

Permalink
fix memory leak when reading invalid tiff - refs mapnik#1783
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer authored and PetrDlouhy committed Aug 21, 2013
1 parent 0ab983e commit 52e72ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tiff_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,12 @@ void tiff_reader::on_error(const char* /*module*/, const char* fmt, va_list argp
void tiff_reader::init()
{
// TODO: error handling
TIFFSetWarningHandler(0);
TIFFSetErrorHandler(on_error);
TIFF* tif = load_if_exists(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];

if (TIFFRGBAImageOK(tif,msg))
Expand Down

0 comments on commit 52e72ff

Please sign in to comment.