tools/fax2tiff.c:387: error: Memory Leak
  memory dynamically allocated by call to `_TIFFmalloc()` at line 375, column 23 is not reachable after line 387, column 2.

tools/fax2tiff.c:362:1: start of procedure copyFaxFile()
360. }
361. 
362. int
     ^
363. copyFaxFile(TIFF* tifin, TIFF* tifout)
364. {

tools/fax2tiff.c:366:20: Condition is true
364. {
365. 	uint32 row;
366. 	uint32 linesize = TIFFhowmany8(xsize);
                        ^
367. 	uint16 badrun;
368. 	int ok;

tools/fax2tiff.c:366:2: 
364. {
365. 	uint32 row;
366. 	uint32 linesize = TIFFhowmany8(xsize);
      ^
367. 	uint16 badrun;
368. 	int ok;

tools/fax2tiff.c:370:2: Skipping __function_pointer__(): unresolved function pointer
368. 	int ok;
369. 
370. 	tifin->tif_rawdatasize = (tmsize_t)TIFFGetFileSize(tifin);
      ^
371. 	if (tifin->tif_rawdatasize == 0) {
372. 		TIFFError(tifin->tif_name, "Empty input file");

tools/fax2tiff.c:371:6: Taking false branch
369. 
370. 	tifin->tif_rawdatasize = (tmsize_t)TIFFGetFileSize(tifin);
371. 	if (tifin->tif_rawdatasize == 0) {
          ^
372. 		TIFFError(tifin->tif_name, "Empty input file");
373. 		return (0);

tools/fax2tiff.c:375:2: 
373. 		return (0);
374. 	}
375. 	tifin->tif_rawdata = _TIFFmalloc(tifin->tif_rawdatasize);
      ^
376. 	if (tifin->tif_rawdata == NULL) {
377. 		TIFFError(tifin->tif_name, "Not enough memory");

libtiff/tif_unix.c:308:1: start of procedure _TIFFmalloc()
  306. #endif
  307. 
  308. void*
       ^
  309. _TIFFmalloc(tmsize_t s)
  310. {

libtiff/tif_unix.c:311:13: Taking false branch
  309. _TIFFmalloc(tmsize_t s)
  310. {
  311.         if (s == 0)
                   ^
  312.                 return ((void *) NULL);
  313. 

libtiff/tif_unix.c:314:2: 
  312.                 return ((void *) NULL);
  313. 
  314. 	return (malloc((size_t) s));
        ^
  315. }
  316. 

libtiff/tif_unix.c:315:1: return from a call to _TIFFmalloc
  313. 
  314. 	return (malloc((size_t) s));
  315. }
       ^
  316. 
  317. void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz)

tools/fax2tiff.c:376:6: Taking false branch
374. 	}
375. 	tifin->tif_rawdata = _TIFFmalloc(tifin->tif_rawdatasize);
376. 	if (tifin->tif_rawdata == NULL) {
          ^
377. 		TIFFError(tifin->tif_name, "Not enough memory");
378. 		return (0);

tools/fax2tiff.c:380:7: Taking false branch
378. 		return (0);
379. 	}
380. 	if (!ReadOK(tifin, tifin->tif_rawdata, tifin->tif_rawdatasize)) {
           ^
381. 		TIFFError(tifin->tif_name, "Read error at scanline 0");
382. 		return (0);

tools/fax2tiff.c:384:2: 
382. 		return (0);
383. 	}
384. 	tifin->tif_rawcp = tifin->tif_rawdata;
      ^
385. 	tifin->tif_rawcc = tifin->tif_rawdatasize;
386. 

tools/fax2tiff.c:385:2: 
383. 	}
384. 	tifin->tif_rawcp = tifin->tif_rawdata;
385. 	tifin->tif_rawcc = tifin->tif_rawdatasize;
      ^
386. 
387. 	(*tifin->tif_setupdecode)(tifin);

tools/fax2tiff.c:387:2: Skipping __function_pointer__(): unresolved function pointer
385. 	tifin->tif_rawcc = tifin->tif_rawdatasize;
386. 
387. 	(*tifin->tif_setupdecode)(tifin);
      ^
388. 	(*tifin->tif_predecode)(tifin, (tsample_t) 0);
389. 	tifin->tif_row = 0;

int
copyFaxFile(TIFF* tifin, TIFF* tifout)
{
	uint32 row;
	uint32 linesize = TIFFhowmany8(xsize);
	uint16 badrun;
	int ok;
	tifin->tif_rawdatasize = (tmsize_t)TIFFGetFileSize(tifin);
	if (tifin->tif_rawdatasize == 0) {
		TIFFError(tifin->tif_name, "Empty input file");
		return (0);
	}
	tifin->tif_rawdata = _TIFFmalloc(tifin->tif_rawdatasize);
	if (tifin->tif_rawdata == NULL) {
		TIFFError(tifin->tif_name, "Not enough memory");
		return (0);
	}
	if (!ReadOK(tifin, tifin->tif_rawdata, tifin->tif_rawdatasize)) {
		TIFFError(tifin->tif_name, "Read error at scanline 0");
		return (0);
	}
	tifin->tif_rawcp = tifin->tif_rawdata;
	tifin->tif_rawcc = tifin->tif_rawdatasize;
	(*tifin->tif_setupdecode)(tifin);
	(*tifin->tif_predecode)(tifin, (tsample_t) 0);
	tifin->tif_row = 0;
	badfaxlines = 0;
	badfaxrun = 0;
	_TIFFmemset(refbuf, 0, linesize);
	row = 0;
	badrun = 0;
	while (tifin->tif_rawcc > 0) {
		ok = (*tifin->tif_decoderow)(tifin, (tdata_t) rowbuf,
					     linesize, 0);
		if (!ok) {
			badfaxlines++;
			badrun++;
			_TIFFmemcpy(rowbuf, refbuf, linesize);
		} else {
			if (badrun > badfaxrun)
				badfaxrun = badrun;
			badrun = 0;
			_TIFFmemcpy(refbuf, rowbuf, linesize);
		}
		tifin->tif_row++;
		if (TIFFWriteScanline(tifout, rowbuf, row, 0) < 0) {
			fprintf(stderr, "%s: Write error at row %ld.\n",
			    tifout->tif_name, (long) row);
			break;
		}
		row++;
		if (stretch) {
			if (TIFFWriteScanline(tifout, rowbuf, row, 0) < 0) {
				fprintf(stderr, "%s: Write error at row %ld.\n",
				    tifout->tif_name, (long) row);
				break;
			}
			row++;
		}
	}
	if (badrun > badfaxrun)
		badfaxrun = badrun;
	_TIFFfree(tifin->tif_rawdata);
	return (row);
}
['int\ncopyFaxFile(TIFF* tifin, TIFF* tifout)\n{\n\tuint32 row;\n\tuint32 linesize = TIFFhowmany8(xsize);\n\tuint16 badrun;\n\tint ok;\n\ttifin->tif_rawdatasize = (tmsize_t)TIFFGetFileSize(tifin);\n\tif (tifin->tif_rawdatasize == 0) {\n\t\tTIFFError(tifin->tif_name, "Empty input file");\n\t\treturn (0);\n\t}\n\ttifin->tif_rawdata = _TIFFmalloc(tifin->tif_rawdatasize);\n\tif (tifin->tif_rawdata == NULL) {\n\t\tTIFFError(tifin->tif_name, "Not enough memory");\n\t\treturn (0);\n\t}\n\tif (!ReadOK(tifin, tifin->tif_rawdata, tifin->tif_rawdatasize)) {\n\t\tTIFFError(tifin->tif_name, "Read error at scanline 0");\n\t\treturn (0);\n\t}\n\ttifin->tif_rawcp = tifin->tif_rawdata;\n\ttifin->tif_rawcc = tifin->tif_rawdatasize;\n\t(*tifin->tif_setupdecode)(tifin);\n\t(*tifin->tif_predecode)(tifin, (tsample_t) 0);\n\ttifin->tif_row = 0;\n\tbadfaxlines = 0;\n\tbadfaxrun = 0;\n\t_TIFFmemset(refbuf, 0, linesize);\n\trow = 0;\n\tbadrun = 0;\n\twhile (tifin->tif_rawcc > 0) {\n\t\tok = (*tifin->tif_decoderow)(tifin, (tdata_t) rowbuf,\n\t\t\t\t\t     linesize, 0);\n\t\tif (!ok) {\n\t\t\tbadfaxlines++;\n\t\t\tbadrun++;\n\t\t\t_TIFFmemcpy(rowbuf, refbuf, linesize);\n\t\t} else {\n\t\t\tif (badrun > badfaxrun)\n\t\t\t\tbadfaxrun = badrun;\n\t\t\tbadrun = 0;\n\t\t\t_TIFFmemcpy(refbuf, rowbuf, linesize);\n\t\t}\n\t\ttifin->tif_row++;\n\t\tif (TIFFWriteScanline(tifout, rowbuf, row, 0) < 0) {\n\t\t\tfprintf(stderr, "%s: Write error at row %ld.\\n",\n\t\t\t    tifout->tif_name, (long) row);\n\t\t\tbreak;\n\t\t}\n\t\trow++;\n\t\tif (stretch) {\n\t\t\tif (TIFFWriteScanline(tifout, rowbuf, row, 0) < 0) {\n\t\t\t\tfprintf(stderr, "%s: Write error at row %ld.\\n",\n\t\t\t\t    tifout->tif_name, (long) row);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\trow++;\n\t\t}\n\t}\n\tif (badrun > badfaxrun)\n\t\tbadfaxrun = badrun;\n\t_TIFFfree(tifin->tif_rawdata);\n\treturn (row);\n}', 'void*\n_TIFFmalloc(tmsize_t s)\n{\n        if (s == 0)\n                return ((void *) NULL);\n\treturn (malloc((size_t) s));\n}']