libtiff/tif_getimage.c:2205: error: Memory Leak
  memory dynamically allocated by call to `_TIFFmalloc()` at line 2185, column 32 is not reachable after line 2205, column 7.

libtiff/tif_getimage.c:2174:1: start of procedure setupMap()
2172.  * process also handles inverting B&W images when needed.
2173.  */ 
2174. static int
      ^
2175. setupMap(TIFFRGBAImage* img)
2176. {

libtiff/tif_getimage.c:2179:5: 
2177.     int32 x, range;
2178. 
2179.     range = (int32)((1L<<img->bitspersample)-1);
          ^
2180.     
2181.     /* treat 16 bit the same as eight bit */

libtiff/tif_getimage.c:2182:9: Taking false branch
2180.     
2181.     /* treat 16 bit the same as eight bit */
2182.     if( img->bitspersample == 16 )
              ^
2183.         range = (int32) 255;
2184. 

libtiff/tif_getimage.c:2185:5: 
2183.         range = (int32) 255;
2184. 
2185.     img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
          ^
2186.     if (img->Map == NULL) {
2187. 		TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),

libtiff/tif_unix.c:253:1: start of procedure _TIFFmalloc()
  251. #endif
  252. 
  253. void*
       ^
  254. _TIFFmalloc(tmsize_t s)
  255. {

libtiff/tif_unix.c:256:2: 
  254. _TIFFmalloc(tmsize_t s)
  255. {
  256. 	return (malloc((size_t) s));
        ^
  257. }
  258. 

libtiff/tif_unix.c:257:1: return from a call to _TIFFmalloc
  255. {
  256. 	return (malloc((size_t) s));
  257. }
       ^
  258. 
  259. void

libtiff/tif_getimage.c:2186:9: Taking false branch
2184. 
2185.     img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
2186.     if (img->Map == NULL) {
              ^
2187. 		TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
2188. 			"No space for photometric conversion table");

libtiff/tif_getimage.c:2191:9: Taking true branch
2189. 		return (0);
2190.     }
2191.     if (img->photometric == PHOTOMETRIC_MINISWHITE) {
              ^
2192. 	for (x = 0; x <= range; x++)
2193. 	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);

libtiff/tif_getimage.c:2192:7: 
2190.     }
2191.     if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2192. 	for (x = 0; x <= range; x++)
            ^
2193. 	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2194.     } else {

libtiff/tif_getimage.c:2192:14: Loop condition is true. Entering loop body
2190.     }
2191.     if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2192. 	for (x = 0; x <= range; x++)
                   ^
2193. 	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2194.     } else {

libtiff/tif_getimage.c:2193:6: 
2191.     if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2192. 	for (x = 0; x <= range; x++)
2193. 	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
           ^
2194.     } else {
2195. 	for (x = 0; x <= range; x++)

libtiff/tif_getimage.c:2192:26: 
2190.     }
2191.     if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2192. 	for (x = 0; x <= range; x++)
                               ^
2193. 	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2194.     } else {

libtiff/tif_getimage.c:2192:14: Loop condition is false. Leaving loop
2190.     }
2191.     if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2192. 	for (x = 0; x <= range; x++)
                   ^
2193. 	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2194.     } else {

libtiff/tif_getimage.c:2198:9: Taking true branch
2196. 	    img->Map[x] = (TIFFRGBValue) ((x * 255) / range);
2197.     }
2198.     if (img->bitspersample <= 16 &&
              ^
2199. 	(img->photometric == PHOTOMETRIC_MINISBLACK ||
2200. 	 img->photometric == PHOTOMETRIC_MINISWHITE)) {

libtiff/tif_getimage.c:2199:3: Taking false branch
2197.     }
2198.     if (img->bitspersample <= 16 &&
2199. 	(img->photometric == PHOTOMETRIC_MINISBLACK ||
        ^
2200. 	 img->photometric == PHOTOMETRIC_MINISWHITE)) {
2201. 	/*

libtiff/tif_getimage.c:2200:3: Taking true branch
2198.     if (img->bitspersample <= 16 &&
2199. 	(img->photometric == PHOTOMETRIC_MINISBLACK ||
2200. 	 img->photometric == PHOTOMETRIC_MINISWHITE)) {
        ^
2201. 	/*
2202. 	 * Use photometric mapping table to construct

libtiff/tif_getimage.c:2205:7: Skipping makebwmap(): empty list of specs
2203. 	 * unpacking tables for samples <= 8 bits.
2204. 	 */
2205. 	if (!makebwmap(img))
            ^
2206. 	    return (0);
2207. 	/* no longer need Map, free it */

static int
setupMap(TIFFRGBAImage* img)
{
    int32 x, range;
    range = (int32)((1L<<img->bitspersample)-1);
    if( img->bitspersample == 16 )
        range = (int32) 255;
    img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
    if (img->Map == NULL) {
		TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),
			"No space for photometric conversion table");
		return (0);
    }
    if (img->photometric == PHOTOMETRIC_MINISWHITE) {
	for (x = 0; x <= range; x++)
	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
    } else {
	for (x = 0; x <= range; x++)
	    img->Map[x] = (TIFFRGBValue) ((x * 255) / range);
    }
    if (img->bitspersample <= 16 &&
	(img->photometric == PHOTOMETRIC_MINISBLACK ||
	 img->photometric == PHOTOMETRIC_MINISWHITE)) {
	if (!makebwmap(img))
	    return (0);
	_TIFFfree(img->Map), img->Map = NULL;
    }
    return (1);
}
['static int\nsetupMap(TIFFRGBAImage* img)\n{\n    int32 x, range;\n    range = (int32)((1L<<img->bitspersample)-1);\n    if( img->bitspersample == 16 )\n        range = (int32) 255;\n    img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));\n    if (img->Map == NULL) {\n\t\tTIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),\n\t\t\t"No space for photometric conversion table");\n\t\treturn (0);\n    }\n    if (img->photometric == PHOTOMETRIC_MINISWHITE) {\n\tfor (x = 0; x <= range; x++)\n\t    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);\n    } else {\n\tfor (x = 0; x <= range; x++)\n\t    img->Map[x] = (TIFFRGBValue) ((x * 255) / range);\n    }\n    if (img->bitspersample <= 16 &&\n\t(img->photometric == PHOTOMETRIC_MINISBLACK ||\n\t img->photometric == PHOTOMETRIC_MINISWHITE)) {\n\tif (!makebwmap(img))\n\t    return (0);\n\t_TIFFfree(img->Map), img->Map = NULL;\n    }\n    return (1);\n}', 'void*\n_TIFFmalloc(tmsize_t s)\n{\n\treturn (malloc((size_t) s));\n}']