Index: tools/tiffdither.c =================================================================== --- tools/tiffdither.c.orig 2015-02-18 13:06:47.972867055 +0100 +++ tools/tiffdither.c 2015-02-18 13:12:03.759562692 +0100 @@ -77,6 +77,11 @@ outlinesize = TIFFScanlineSize(out); outline = (unsigned char *) _TIFFmalloc(outlinesize); + if (! (inputline && thisline && nextline && outline)) { + fprintf(stderr, "Out of memory.\n"); + return; + } + /* * Get first line */