libtiff/tif_lzw.c:222: error: Memory Leak
  memory dynamically allocated by call to `_TIFFmalloc()` at line 209, column 28 is not reachable after line 222, column 10.

libtiff/tif_lzw.c:196:1: start of procedure LZWSetupDecode()
194. }
195. 
196. static int
     ^
197. LZWSetupDecode(TIFF* tif)
198. {

libtiff/tif_lzw.c:199:2: 
197. LZWSetupDecode(TIFF* tif)
198. {
199. 	static const char module[] = "LZWSetupDecode";
      ^
200. 	LZWCodecState* sp = DecoderState(tif);
201. 	int code;

libtiff/tif_lzw.c:200:2: 
198. {
199. 	static const char module[] = "LZWSetupDecode";
200. 	LZWCodecState* sp = DecoderState(tif);
      ^
201. 	int code;
202. 

libtiff/tif_lzw.c:203:6: Taking true branch
201. 	int code;
202. 
203. 	if( sp == NULL )
          ^
204. 	{
205. 		/*

libtiff/tif_lzw.c:209:3: 
207. 		 * values.
208. 		*/
209. 		tif->tif_data = (uint8*) _TIFFmalloc(sizeof(LZWCodecState));
       ^
210. 		if (tif->tif_data == NULL)
211. 		{

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)

libtiff/tif_lzw.c:210:7: Taking false branch
208. 		*/
209. 		tif->tif_data = (uint8*) _TIFFmalloc(sizeof(LZWCodecState));
210. 		if (tif->tif_data == NULL)
           ^
211. 		{
212. 			TIFFErrorExt(tif->tif_clientdata, module, "No space for LZW state block");

libtiff/tif_lzw.c:216:3: 
214. 		}
215. 
216. 		DecoderState(tif)->dec_codetab = NULL;
       ^
217. 		DecoderState(tif)->dec_decode = NULL;
218. 

libtiff/tif_lzw.c:217:3: 
215. 
216. 		DecoderState(tif)->dec_codetab = NULL;
217. 		DecoderState(tif)->dec_decode = NULL;
       ^
218. 
219. 		/*

libtiff/tif_lzw.c:222:10: 
220. 		 * Setup predictor setup.
221. 		 */
222. 		(void) TIFFPredictorInit(tif);
              ^
223. 
224. 		sp = DecoderState(tif);

libtiff/tif_predict.c:815:1: start of procedure TIFFPredictorInit()
  813. }
  814. 
  815. int
       ^
  816. TIFFPredictorInit(TIFF* tif)
  817. {

libtiff/tif_predict.c:818:2: 
  816. TIFFPredictorInit(TIFF* tif)
  817. {
  818. 	TIFFPredictorState* sp = PredictorState(tif);
        ^
  819. 
  820. 	assert(sp != 0);

libtiff/tif_predict.c:820:2: Condition is true
  818. 	TIFFPredictorState* sp = PredictorState(tif);
  819. 
  820. 	assert(sp != 0);
        ^
  821. 
  822. 	/*

libtiff/tif_predict.c:825:7: Taking true branch
  823. 	 * Merge codec-specific tag information.
  824. 	 */
  825. 	if (!_TIFFMergeFields(tif, predictFields,
             ^
  826. 			      TIFFArrayCount(predictFields))) {
  827. 		TIFFErrorExt(tif->tif_clientdata, "TIFFPredictorInit",

libtiff/tif_predict.c:827:3: 
  825. 	if (!_TIFFMergeFields(tif, predictFields,
  826. 			      TIFFArrayCount(predictFields))) {
  827. 		TIFFErrorExt(tif->tif_clientdata, "TIFFPredictorInit",
         ^
  828. 		    "Merging Predictor codec-specific tags failed");
  829. 		return 0;

libtiff/tif_error.c:64:1: start of procedure TIFFErrorExt()
    62. }
    63. 
    64. void
        ^
    65. TIFFErrorExt(thandle_t fd, const char* module, const char* fmt, ...)
    66. {

libtiff/tif_error.c:68:6: Taking false branch
    66. {
    67. 	va_list ap;
    68. 	if (_TIFFerrorHandler) {
             ^
    69. 		va_start(ap, fmt);
    70. 		(*_TIFFerrorHandler)(module, fmt, ap);

libtiff/tif_error.c:73:6: Taking false branch
    71. 		va_end(ap);
    72. 	}
    73. 	if (_TIFFerrorHandlerExt) {
             ^
    74. 		va_start(ap, fmt);
    75. 		(*_TIFFerrorHandlerExt)(fd, module, fmt, ap);

libtiff/tif_error.c:73:2: 
    71. 		va_end(ap);
    72. 	}
    73. 	if (_TIFFerrorHandlerExt) {
         ^
    74. 		va_start(ap, fmt);
    75. 		(*_TIFFerrorHandlerExt)(fd, module, fmt, ap);

libtiff/tif_error.c:78:1: return from a call to TIFFErrorExt
    76. 		va_end(ap);
    77. 	}
    78. }
        ^
    79. 
    80. /*

libtiff/tif_predict.c:829:3: 
  827. 		TIFFErrorExt(tif->tif_clientdata, "TIFFPredictorInit",
  828. 		    "Merging Predictor codec-specific tags failed");
  829. 		return 0;
         ^
  830. 	}
  831. 

libtiff/tif_predict.c:854:1: return from a call to TIFFPredictorInit
  852. 	sp->decodepfunc = NULL;			/* no predictor routine */
  853. 	return 1;
  854. }
       ^
  855. 
  856. int

static int
LZWSetupDecode(TIFF* tif)
{
	static const char module[] = "LZWSetupDecode";
	LZWCodecState* sp = DecoderState(tif);
	int code;
	if( sp == NULL )
	{
		tif->tif_data = (uint8*) _TIFFmalloc(sizeof(LZWCodecState));
		if (tif->tif_data == NULL)
		{
			TIFFErrorExt(tif->tif_clientdata, module, "No space for LZW state block");
			return (0);
		}
		DecoderState(tif)->dec_codetab = NULL;
		DecoderState(tif)->dec_decode = NULL;
		(void) TIFFPredictorInit(tif);
		sp = DecoderState(tif);
	}
	assert(sp != NULL);
	if (sp->dec_codetab == NULL) {
		sp->dec_codetab = (code_t*)_TIFFmalloc(CSIZE*sizeof (code_t));
		if (sp->dec_codetab == NULL) {
			TIFFErrorExt(tif->tif_clientdata, module,
				     "No space for LZW code table");
			return (0);
		}
		code = 255;
		do {
			sp->dec_codetab[code].value = (unsigned char)code;
			sp->dec_codetab[code].firstchar = (unsigned char)code;
			sp->dec_codetab[code].length = 1;
			sp->dec_codetab[code].next = NULL;
		} while (code--);
                 _TIFFmemset(&sp->dec_codetab[CODE_CLEAR], 0,
			     (CODE_FIRST - CODE_CLEAR) * sizeof (code_t));
	}
	return (1);
}
['static int\nLZWSetupDecode(TIFF* tif)\n{\n\tstatic const char module[] = "LZWSetupDecode";\n\tLZWCodecState* sp = DecoderState(tif);\n\tint code;\n\tif( sp == NULL )\n\t{\n\t\ttif->tif_data = (uint8*) _TIFFmalloc(sizeof(LZWCodecState));\n\t\tif (tif->tif_data == NULL)\n\t\t{\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module, "No space for LZW state block");\n\t\t\treturn (0);\n\t\t}\n\t\tDecoderState(tif)->dec_codetab = NULL;\n\t\tDecoderState(tif)->dec_decode = NULL;\n\t\t(void) TIFFPredictorInit(tif);\n\t\tsp = DecoderState(tif);\n\t}\n\tassert(sp != NULL);\n\tif (sp->dec_codetab == NULL) {\n\t\tsp->dec_codetab = (code_t*)_TIFFmalloc(CSIZE*sizeof (code_t));\n\t\tif (sp->dec_codetab == NULL) {\n\t\t\tTIFFErrorExt(tif->tif_clientdata, module,\n\t\t\t\t     "No space for LZW code table");\n\t\t\treturn (0);\n\t\t}\n\t\tcode = 255;\n\t\tdo {\n\t\t\tsp->dec_codetab[code].value = (unsigned char)code;\n\t\t\tsp->dec_codetab[code].firstchar = (unsigned char)code;\n\t\t\tsp->dec_codetab[code].length = 1;\n\t\t\tsp->dec_codetab[code].next = NULL;\n\t\t} while (code--);\n                 _TIFFmemset(&sp->dec_codetab[CODE_CLEAR], 0,\n\t\t\t     (CODE_FIRST - CODE_CLEAR) * sizeof (code_t));\n\t}\n\treturn (1);\n}', 'void*\n_TIFFmalloc(tmsize_t s)\n{\n        if (s == 0)\n                return ((void *) NULL);\n\treturn (malloc((size_t) s));\n}', 'int\nTIFFPredictorInit(TIFF* tif)\n{\n\tTIFFPredictorState* sp = PredictorState(tif);\n\tassert(sp != 0);\n\tif (!_TIFFMergeFields(tif, predictFields,\n\t\t\t      TIFFArrayCount(predictFields))) {\n\t\tTIFFErrorExt(tif->tif_clientdata, "TIFFPredictorInit",\n\t\t    "Merging Predictor codec-specific tags failed");\n\t\treturn 0;\n\t}\n\tsp->vgetparent = tif->tif_tagmethods.vgetfield;\n\ttif->tif_tagmethods.vgetfield =\n            PredictorVGetField;\n\tsp->vsetparent = tif->tif_tagmethods.vsetfield;\n\ttif->tif_tagmethods.vsetfield =\n\t    PredictorVSetField;\n\tsp->printdir = tif->tif_tagmethods.printdir;\n\ttif->tif_tagmethods.printdir =\n            PredictorPrintDir;\n\tsp->setupdecode = tif->tif_setupdecode;\n\ttif->tif_setupdecode = PredictorSetupDecode;\n\tsp->setupencode = tif->tif_setupencode;\n\ttif->tif_setupencode = PredictorSetupEncode;\n\tsp->predictor = 1;\n\tsp->encodepfunc = NULL;\n\tsp->decodepfunc = NULL;\n\treturn 1;\n}', 'void\nTIFFErrorExt(thandle_t fd, const char* module, const char* fmt, ...)\n{\n\tva_list ap;\n\tif (_TIFFerrorHandler) {\n\t\tva_start(ap, fmt);\n\t\t(*_TIFFerrorHandler)(module, fmt, ap);\n\t\tva_end(ap);\n\t}\n\tif (_TIFFerrorHandlerExt) {\n\t\tva_start(ap, fmt);\n\t\t(*_TIFFerrorHandlerExt)(fd, module, fmt, ap);\n\t\tva_end(ap);\n\t}\n}']