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

libtiff/tif_getimage.c:2270:1: start of procedure setupMap()
2268.  * process also handles inverting B&W images when needed.
2269.  */ 
2270. static int
      ^
2271. setupMap(TIFFRGBAImage* img)
2272. {

libtiff/tif_getimage.c:2275:5: 
2273.     int32 x, range;
2274. 
2275.     range = (int32)((1L<<img->bitspersample)-1);
          ^
2276.     
2277.     /* treat 16 bit the same as eight bit */

libtiff/tif_getimage.c:2278:9: Taking false branch
2276.     
2277.     /* treat 16 bit the same as eight bit */
2278.     if( img->bitspersample == 16 )
              ^
2279.         range = (int32) 255;
2280. 

libtiff/tif_getimage.c:2281:5: 
2279.         range = (int32) 255;
2280. 
2281.     img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
          ^
2282.     if (img->Map == NULL) {
2283. 		TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif),

libtiff/tif_unix.c:257:1: start of procedure _TIFFmalloc()
  255. #endif
  256. 
  257. void*
       ^
  258. _TIFFmalloc(tmsize_t s)
  259. {

libtiff/tif_unix.c:260:2: 
  258. _TIFFmalloc(tmsize_t s)
  259. {
  260. 	return (malloc((size_t) s));
        ^
  261. }
  262. 

libtiff/tif_unix.c:261:1: return from a call to _TIFFmalloc
  259. {
  260. 	return (malloc((size_t) s));
  261. }
       ^
  262. 
  263. void

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

libtiff/tif_getimage.c:2287:9: Taking true branch
2285. 		return (0);
2286.     }
2287.     if (img->photometric == PHOTOMETRIC_MINISWHITE) {
              ^
2288. 	for (x = 0; x <= range; x++)
2289. 	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);

libtiff/tif_getimage.c:2288:7: 
2286.     }
2287.     if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2288. 	for (x = 0; x <= range; x++)
            ^
2289. 	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2290.     } else {

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

libtiff/tif_getimage.c:2289:6: 
2287.     if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2288. 	for (x = 0; x <= range; x++)
2289. 	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
           ^
2290.     } else {
2291. 	for (x = 0; x <= range; x++)

libtiff/tif_getimage.c:2288:26: 
2286.     }
2287.     if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2288. 	for (x = 0; x <= range; x++)
                               ^
2289. 	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2290.     } else {

libtiff/tif_getimage.c:2288:14: Loop condition is false. Leaving loop
2286.     }
2287.     if (img->photometric == PHOTOMETRIC_MINISWHITE) {
2288. 	for (x = 0; x <= range; x++)
                   ^
2289. 	    img->Map[x] = (TIFFRGBValue) (((range - x) * 255) / range);
2290.     } else {

libtiff/tif_getimage.c:2294:9: Taking true branch
2292. 	    img->Map[x] = (TIFFRGBValue) ((x * 255) / range);
2293.     }
2294.     if (img->bitspersample <= 16 &&
              ^
2295. 	(img->photometric == PHOTOMETRIC_MINISBLACK ||
2296. 	 img->photometric == PHOTOMETRIC_MINISWHITE)) {

libtiff/tif_getimage.c:2295:3: Taking false branch
2293.     }
2294.     if (img->bitspersample <= 16 &&
2295. 	(img->photometric == PHOTOMETRIC_MINISBLACK ||
        ^
2296. 	 img->photometric == PHOTOMETRIC_MINISWHITE)) {
2297. 	/*

libtiff/tif_getimage.c:2296:3: Taking true branch
2294.     if (img->bitspersample <= 16 &&
2295. 	(img->photometric == PHOTOMETRIC_MINISBLACK ||
2296. 	 img->photometric == PHOTOMETRIC_MINISWHITE)) {
        ^
2297. 	/*
2298. 	 * Use photometric mapping table to construct

libtiff/tif_getimage.c:2301:7: Skipping makebwmap(): empty list of specs
2299. 	 * unpacking tables for samples <= 8 bits.
2300. 	 */
2301. 	if (!makebwmap(img))
            ^
2302. 	    return (0);
2303. 	/* 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}']