tools/tiffcp.c:1125: error: Memory Leak
  memory dynamically allocated by call to `_TIFFmalloc()` at line 1123, column 10 is not reachable after line 1125, column 17.

tools/tiffcp.c:1112:1: start of procedure cpSeparate2ContigByRow()
1110.  * Separate -> contig by row.
1111.  */
1112. DECLAREcpFunc(cpSeparate2ContigByRow)
      ^
1113. {
1114. 	tsize_t scanlinesizein = TIFFScanlineSize(in);

tools/tiffcp.c:1114:2: 
1112. DECLAREcpFunc(cpSeparate2ContigByRow)
1113. {
1114. 	tsize_t scanlinesizein = TIFFScanlineSize(in);
       ^
1115. 	tsize_t scanlinesizeout = TIFFScanlineSize(out);
1116. 	tdata_t inbuf;

libtiff/tif_strip.c:323:1: start of procedure TIFFScanlineSize()
  321. 	return(scanline_size);
  322. }
  323. tmsize_t
       ^
  324. TIFFScanlineSize(TIFF* tif)
  325. {

libtiff/tif_strip.c:326:2: 
  324. TIFFScanlineSize(TIFF* tif)
  325. {
  326. 	static const char module[] = "TIFFScanlineSize";
        ^
  327. 	uint64 m;
  328. 	tmsize_t n;

libtiff/tif_strip.c:329:2: Skipping TIFFScanlineSize64(): empty list of specs
  327. 	uint64 m;
  328. 	tmsize_t n;
  329. 	m=TIFFScanlineSize64(tif);
        ^
  330. 	n=(tmsize_t)m;
  331. 	if ((uint64)n!=m)

libtiff/tif_strip.c:330:2: 
  328. 	tmsize_t n;
  329. 	m=TIFFScanlineSize64(tif);
  330. 	n=(tmsize_t)m;
        ^
  331. 	if ((uint64)n!=m)
  332. 	{

libtiff/tif_strip.c:331:6: Taking false branch
  329. 	m=TIFFScanlineSize64(tif);
  330. 	n=(tmsize_t)m;
  331. 	if ((uint64)n!=m)
            ^
  332. 	{
  333. 		TIFFErrorExt(tif->tif_clientdata,module,"Integer arithmetic overflow");

libtiff/tif_strip.c:336:2: 
  334. 		n=0;
  335. 	}
  336. 	return(n);
        ^
  337. }
  338. 

libtiff/tif_strip.c:337:1: return from a call to TIFFScanlineSize
  335. 	}
  336. 	return(n);
  337. }
       ^
  338. 
  339. /*

tools/tiffcp.c:1115:2: 
1113. {
1114. 	tsize_t scanlinesizein = TIFFScanlineSize(in);
1115. 	tsize_t scanlinesizeout = TIFFScanlineSize(out);
       ^
1116. 	tdata_t inbuf;
1117. 	tdata_t outbuf;

libtiff/tif_strip.c:323:1: start of procedure TIFFScanlineSize()
  321. 	return(scanline_size);
  322. }
  323. tmsize_t
       ^
  324. TIFFScanlineSize(TIFF* tif)
  325. {

libtiff/tif_strip.c:326:2: 
  324. TIFFScanlineSize(TIFF* tif)
  325. {
  326. 	static const char module[] = "TIFFScanlineSize";
        ^
  327. 	uint64 m;
  328. 	tmsize_t n;

libtiff/tif_strip.c:329:2: Skipping TIFFScanlineSize64(): empty list of specs
  327. 	uint64 m;
  328. 	tmsize_t n;
  329. 	m=TIFFScanlineSize64(tif);
        ^
  330. 	n=(tmsize_t)m;
  331. 	if ((uint64)n!=m)

libtiff/tif_strip.c:330:2: 
  328. 	tmsize_t n;
  329. 	m=TIFFScanlineSize64(tif);
  330. 	n=(tmsize_t)m;
        ^
  331. 	if ((uint64)n!=m)
  332. 	{

libtiff/tif_strip.c:331:6: Taking false branch
  329. 	m=TIFFScanlineSize64(tif);
  330. 	n=(tmsize_t)m;
  331. 	if ((uint64)n!=m)
            ^
  332. 	{
  333. 		TIFFErrorExt(tif->tif_clientdata,module,"Integer arithmetic overflow");

libtiff/tif_strip.c:336:2: 
  334. 		n=0;
  335. 	}
  336. 	return(n);
        ^
  337. }
  338. 

libtiff/tif_strip.c:337:1: return from a call to TIFFScanlineSize
  335. 	}
  336. 	return(n);
  337. }
       ^
  338. 
  339. /*

tools/tiffcp.c:1123:2: 
1121. 	tsample_t s;
1122. 
1123. 	inbuf = _TIFFmalloc(scanlinesizein);
       ^
1124. 	outbuf = _TIFFmalloc(scanlinesizeout);
1125. 	if (!inbuf || !outbuf)

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:13: Taking false branch
  258. _TIFFmalloc(tmsize_t s)
  259. {
  260.         if (s == 0)
                   ^
  261.                 return ((void *) NULL);
  262. 

libtiff/tif_unix.c:263:2: 
  261.                 return ((void *) NULL);
  262. 
  263. 	return (malloc((size_t) s));
        ^
  264. }
  265. 

libtiff/tif_unix.c:264:1: return from a call to _TIFFmalloc
  262. 
  263. 	return (malloc((size_t) s));
  264. }
       ^
  265. 
  266. void

tools/tiffcp.c:1124:2: 
1122. 
1123. 	inbuf = _TIFFmalloc(scanlinesizein);
1124. 	outbuf = _TIFFmalloc(scanlinesizeout);
       ^
1125. 	if (!inbuf || !outbuf)
1126. 		return 0;

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:13: Taking false branch
  258. _TIFFmalloc(tmsize_t s)
  259. {
  260.         if (s == 0)
                   ^
  261.                 return ((void *) NULL);
  262. 

libtiff/tif_unix.c:263:2: 
  261.                 return ((void *) NULL);
  262. 
  263. 	return (malloc((size_t) s));
        ^
  264. }
  265. 

libtiff/tif_unix.c:264:1: return from a call to _TIFFmalloc
  262. 
  263. 	return (malloc((size_t) s));
  264. }
       ^
  265. 
  266. void

tools/tiffcp.c:1125:7: Taking false branch
1123. 	inbuf = _TIFFmalloc(scanlinesizein);
1124. 	outbuf = _TIFFmalloc(scanlinesizeout);
1125. 	if (!inbuf || !outbuf)
            ^
1126. 		return 0;
1127. 	_TIFFmemset(inbuf, 0, scanlinesizein);

tools/tiffcp.c:1125:17: Taking true branch
1123. 	inbuf = _TIFFmalloc(scanlinesizein);
1124. 	outbuf = _TIFFmalloc(scanlinesizeout);
1125. 	if (!inbuf || !outbuf)
                      ^
1126. 		return 0;
1127. 	_TIFFmemset(inbuf, 0, scanlinesizein);

DECLAREcpFunc(cpSeparate2ContigByRow)
{
	tsize_t scanlinesizein = TIFFScanlineSize(in);
	tsize_t scanlinesizeout = TIFFScanlineSize(out);
	tdata_t inbuf;
	tdata_t outbuf;
	register uint8 *inp, *outp;
	register uint32 n;
	uint32 row;
	tsample_t s;
	inbuf = _TIFFmalloc(scanlinesizein);
	outbuf = _TIFFmalloc(scanlinesizeout);
	if (!inbuf || !outbuf)
		return 0;
	_TIFFmemset(inbuf, 0, scanlinesizein);
	_TIFFmemset(outbuf, 0, scanlinesizeout);
	for (row = 0; row < imagelength; row++) {
		for (s = 0; s < spp; s++) {
			if (TIFFReadScanline(in, inbuf, row, s) < 0
			    && !ignore) {
				TIFFError(TIFFFileName(in),
				    "Error, can't read scanline %lu",
				    (unsigned long) row);
				goto bad;
			}
			inp = (uint8*)inbuf;
			outp = ((uint8*)outbuf) + s;
			for (n = imagewidth; n-- > 0;) {
				*outp = *inp++;
				outp += spp;
			}
		}
		if (TIFFWriteScanline(out, outbuf, row, 0) < 0) {
			TIFFError(TIFFFileName(out),
			    "Error, can't write scanline %lu",
			    (unsigned long) row);
			goto bad;
		}
	}
	if (inbuf) _TIFFfree(inbuf);
	if (outbuf) _TIFFfree(outbuf);
	return 1;
bad:
	if (inbuf) _TIFFfree(inbuf);
	if (outbuf) _TIFFfree(outbuf);
	return 0;
}
['DECLAREcpFunc(cpSeparate2ContigByRow)\n{\n\ttsize_t scanlinesizein = TIFFScanlineSize(in);\n\ttsize_t scanlinesizeout = TIFFScanlineSize(out);\n\ttdata_t inbuf;\n\ttdata_t outbuf;\n\tregister uint8 *inp, *outp;\n\tregister uint32 n;\n\tuint32 row;\n\ttsample_t s;\n\tinbuf = _TIFFmalloc(scanlinesizein);\n\toutbuf = _TIFFmalloc(scanlinesizeout);\n\tif (!inbuf || !outbuf)\n\t\treturn 0;\n\t_TIFFmemset(inbuf, 0, scanlinesizein);\n\t_TIFFmemset(outbuf, 0, scanlinesizeout);\n\tfor (row = 0; row < imagelength; row++) {\n\t\tfor (s = 0; s < spp; s++) {\n\t\t\tif (TIFFReadScanline(in, inbuf, row, s) < 0\n\t\t\t    && !ignore) {\n\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t    "Error, can\'t read scanline %lu",\n\t\t\t\t    (unsigned long) row);\n\t\t\t\tgoto bad;\n\t\t\t}\n\t\t\tinp = (uint8*)inbuf;\n\t\t\toutp = ((uint8*)outbuf) + s;\n\t\t\tfor (n = imagewidth; n-- > 0;) {\n\t\t\t\t*outp = *inp++;\n\t\t\t\toutp += spp;\n\t\t\t}\n\t\t}\n\t\tif (TIFFWriteScanline(out, outbuf, row, 0) < 0) {\n\t\t\tTIFFError(TIFFFileName(out),\n\t\t\t    "Error, can\'t write scanline %lu",\n\t\t\t    (unsigned long) row);\n\t\t\tgoto bad;\n\t\t}\n\t}\n\tif (inbuf) _TIFFfree(inbuf);\n\tif (outbuf) _TIFFfree(outbuf);\n\treturn 1;\nbad:\n\tif (inbuf) _TIFFfree(inbuf);\n\tif (outbuf) _TIFFfree(outbuf);\n\treturn 0;\n}', 'tmsize_t\nTIFFScanlineSize(TIFF* tif)\n{\n\tstatic const char module[] = "TIFFScanlineSize";\n\tuint64 m;\n\ttmsize_t n;\n\tm=TIFFScanlineSize64(tif);\n\tn=(tmsize_t)m;\n\tif ((uint64)n!=m)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,"Integer arithmetic overflow");\n\t\tn=0;\n\t}\n\treturn(n);\n}', 'void*\n_TIFFmalloc(tmsize_t s)\n{\n        if (s == 0)\n                return ((void *) NULL);\n\treturn (malloc((size_t) s));\n}']