tools/tiffcp.c:1115: error: Memory Leak
  memory dynamically allocated by call to `_TIFFmalloc()` at line 1114, column 11 is not reachable after line 1115, column 7.

tools/tiffcp.c:1102:1: start of procedure cpSeparate2ContigByRow()
1100.  * Separate -> contig by row.
1101.  */
1102. DECLAREcpFunc(cpSeparate2ContigByRow)
      ^
1103. {
1104. 	tsize_t scanlinesizein = TIFFScanlineSize(in);

tools/tiffcp.c:1104:2: 
1102. DECLAREcpFunc(cpSeparate2ContigByRow)
1103. {
1104. 	tsize_t scanlinesizein = TIFFScanlineSize(in);
       ^
1105. 	tsize_t scanlinesizeout = TIFFScanlineSize(out);
1106. 	tdata_t inbuf;

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

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

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

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

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

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

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

tools/tiffcp.c:1105:2: 
1103. {
1104. 	tsize_t scanlinesizein = TIFFScanlineSize(in);
1105. 	tsize_t scanlinesizeout = TIFFScanlineSize(out);
       ^
1106. 	tdata_t inbuf;
1107. 	tdata_t outbuf;

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

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

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

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

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

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

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

tools/tiffcp.c:1113:2: 
1111. 	tsample_t s;
1112. 
1113. 	inbuf = _TIFFmalloc(scanlinesizein);
       ^
1114. 	outbuf = _TIFFmalloc(scanlinesizeout);
1115. 	if (!inbuf || !outbuf)

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

tools/tiffcp.c:1114:2: 
1112. 
1113. 	inbuf = _TIFFmalloc(scanlinesizein);
1114. 	outbuf = _TIFFmalloc(scanlinesizeout);
       ^
1115. 	if (!inbuf || !outbuf)
1116. 		return 0;

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

tools/tiffcp.c:1115:7: Taking true branch
1113. 	inbuf = _TIFFmalloc(scanlinesizein);
1114. 	outbuf = _TIFFmalloc(scanlinesizeout);
1115. 	if (!inbuf || !outbuf)
            ^
1116. 		return 0;
1117. 	_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\treturn (malloc((size_t) s));\n}']