libtiff/tif_jpeg.c:757: error: Memory Leak
  memory dynamically allocated by call to `_TIFFmalloc()` at line 745, column 11 is not reachable after line 757, column 7.

libtiff/tif_jpeg.c:705:1: start of procedure JPEGFixupTagsSubsampling()
703. #ifdef CHECK_JPEG_YCBCR_SUBSAMPLING
704. 
705. static void
     ^
706. JPEGFixupTagsSubsampling(TIFF* tif)
707. {

libtiff/tif_jpeg.c:728:2: 
726. 	 * Joris Van Damme, May 2007
727. 	 */
728. 	static const char module[] = "JPEGFixupTagsSubsampling";
      ^
729. 	struct JPEGFixupTagsSubsamplingData m;
730. 

libtiff/tif_jpeg.c:731:9: 
729. 	struct JPEGFixupTagsSubsamplingData m;
730. 
731.         _TIFFFillStriles( tif );
             ^
732.         
733.         if( tif->tif_dir.td_stripbytecount == NULL

libtiff/tif_dirread.c:5585:1: start of procedure _TIFFFillStriles()
  5583. }
  5584. 
  5585. int _TIFFFillStriles( TIFF *tif )
        ^
  5586. {
  5587. #if defined(DEFER_STRILE_LOAD)

libtiff/tif_dirread.c:5627:9: 
  5625.         return return_value;
  5626. #else /* !defined(DEFER_STRILE_LOAD) */
  5627.         (void) tif;
                ^
  5628.         return 1;
  5629. #endif 

libtiff/tif_dirread.c:5628:9: 
  5626. #else /* !defined(DEFER_STRILE_LOAD) */
  5627.         (void) tif;
  5628.         return 1;
                ^
  5629. #endif 
  5630. }

libtiff/tif_dirread.c:5630:1: return from a call to _TIFFFillStriles
  5628.         return 1;
  5629. #endif 
  5630. }
        ^
  5631. 
  5632. 

libtiff/tif_jpeg.c:733:13: Taking false branch
731.         _TIFFFillStriles( tif );
732.         
733.         if( tif->tif_dir.td_stripbytecount == NULL
                 ^
734.             || tif->tif_dir.td_stripoffset == NULL
735.             || tif->tif_dir.td_stripbytecount[0] == 0 )

libtiff/tif_jpeg.c:734:16: Taking false branch
732.         
733.         if( tif->tif_dir.td_stripbytecount == NULL
734.             || tif->tif_dir.td_stripoffset == NULL
                    ^
735.             || tif->tif_dir.td_stripbytecount[0] == 0 )
736.         {

libtiff/tif_jpeg.c:735:16: Taking false branch
733.         if( tif->tif_dir.td_stripbytecount == NULL
734.             || tif->tif_dir.td_stripoffset == NULL
735.             || tif->tif_dir.td_stripbytecount[0] == 0 )
                    ^
736.         {
737.             /* Do not even try to check if the first strip/tile does not

libtiff/tif_jpeg.c:743:2: 
741.         }
742. 
743. 	m.tif=tif;
      ^
744. 	m.buffersize=2048;
745. 	m.buffer=_TIFFmalloc(m.buffersize);

libtiff/tif_jpeg.c:744:2: 
742. 
743. 	m.tif=tif;
744. 	m.buffersize=2048;
      ^
745. 	m.buffer=_TIFFmalloc(m.buffersize);
746. 	if (m.buffer==NULL)

libtiff/tif_jpeg.c:745:2: 
743. 	m.tif=tif;
744. 	m.buffersize=2048;
745. 	m.buffer=_TIFFmalloc(m.buffersize);
      ^
746. 	if (m.buffer==NULL)
747. 	{

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

libtiff/tif_jpeg.c:746:6: Taking false branch
744. 	m.buffersize=2048;
745. 	m.buffer=_TIFFmalloc(m.buffersize);
746. 	if (m.buffer==NULL)
          ^
747. 	{
748. 		TIFFWarningExt(tif->tif_clientdata,module,

libtiff/tif_jpeg.c:752:2: 
750. 		return;
751. 	}
752. 	m.buffercurrentbyte=NULL;
      ^
753. 	m.bufferbytesleft=0;
754. 	m.fileoffset=tif->tif_dir.td_stripoffset[0];

libtiff/tif_jpeg.c:753:2: 
751. 	}
752. 	m.buffercurrentbyte=NULL;
753. 	m.bufferbytesleft=0;
      ^
754. 	m.fileoffset=tif->tif_dir.td_stripoffset[0];
755. 	m.filepositioned=0;

libtiff/tif_jpeg.c:754:2: 
752. 	m.buffercurrentbyte=NULL;
753. 	m.bufferbytesleft=0;
754. 	m.fileoffset=tif->tif_dir.td_stripoffset[0];
      ^
755. 	m.filepositioned=0;
756. 	m.filebytesleft=tif->tif_dir.td_stripbytecount[0];

libtiff/tif_jpeg.c:755:2: 
753. 	m.bufferbytesleft=0;
754. 	m.fileoffset=tif->tif_dir.td_stripoffset[0];
755. 	m.filepositioned=0;
      ^
756. 	m.filebytesleft=tif->tif_dir.td_stripbytecount[0];
757. 	if (!JPEGFixupTagsSubsamplingSec(&m))

libtiff/tif_jpeg.c:756:2: 
754. 	m.fileoffset=tif->tif_dir.td_stripoffset[0];
755. 	m.filepositioned=0;
756. 	m.filebytesleft=tif->tif_dir.td_stripbytecount[0];
      ^
757. 	if (!JPEGFixupTagsSubsamplingSec(&m))
758. 		TIFFWarningExt(tif->tif_clientdata,module,

libtiff/tif_jpeg.c:757:7: Skipping JPEGFixupTagsSubsamplingSec(): empty list of specs
755. 	m.filepositioned=0;
756. 	m.filebytesleft=tif->tif_dir.td_stripbytecount[0];
757. 	if (!JPEGFixupTagsSubsamplingSec(&m))
           ^
758. 		TIFFWarningExt(tif->tif_clientdata,module,
759. 		    "Unable to auto-correct subsampling values, likely corrupt JPEG compressed data in first strip/tile; auto-correcting skipped");

static void
JPEGFixupTagsSubsampling(TIFF* tif)
{
	static const char module[] = "JPEGFixupTagsSubsampling";
	struct JPEGFixupTagsSubsamplingData m;
        _TIFFFillStriles( tif );
        if( tif->tif_dir.td_stripbytecount == NULL
            || tif->tif_dir.td_stripoffset == NULL
            || tif->tif_dir.td_stripbytecount[0] == 0 )
        {
            return;
        }
	m.tif=tif;
	m.buffersize=2048;
	m.buffer=_TIFFmalloc(m.buffersize);
	if (m.buffer==NULL)
	{
		TIFFWarningExt(tif->tif_clientdata,module,
		    "Unable to allocate memory for auto-correcting of subsampling values; auto-correcting skipped");
		return;
	}
	m.buffercurrentbyte=NULL;
	m.bufferbytesleft=0;
	m.fileoffset=tif->tif_dir.td_stripoffset[0];
	m.filepositioned=0;
	m.filebytesleft=tif->tif_dir.td_stripbytecount[0];
	if (!JPEGFixupTagsSubsamplingSec(&m))
		TIFFWarningExt(tif->tif_clientdata,module,
		    "Unable to auto-correct subsampling values, likely corrupt JPEG compressed data in first strip/tile; auto-correcting skipped");
	_TIFFfree(m.buffer);
}
['static void\nJPEGFixupTagsSubsampling(TIFF* tif)\n{\n\tstatic const char module[] = "JPEGFixupTagsSubsampling";\n\tstruct JPEGFixupTagsSubsamplingData m;\n        _TIFFFillStriles( tif );\n        if( tif->tif_dir.td_stripbytecount == NULL\n            || tif->tif_dir.td_stripoffset == NULL\n            || tif->tif_dir.td_stripbytecount[0] == 0 )\n        {\n            return;\n        }\n\tm.tif=tif;\n\tm.buffersize=2048;\n\tm.buffer=_TIFFmalloc(m.buffersize);\n\tif (m.buffer==NULL)\n\t{\n\t\tTIFFWarningExt(tif->tif_clientdata,module,\n\t\t    "Unable to allocate memory for auto-correcting of subsampling values; auto-correcting skipped");\n\t\treturn;\n\t}\n\tm.buffercurrentbyte=NULL;\n\tm.bufferbytesleft=0;\n\tm.fileoffset=tif->tif_dir.td_stripoffset[0];\n\tm.filepositioned=0;\n\tm.filebytesleft=tif->tif_dir.td_stripbytecount[0];\n\tif (!JPEGFixupTagsSubsamplingSec(&m))\n\t\tTIFFWarningExt(tif->tif_clientdata,module,\n\t\t    "Unable to auto-correct subsampling values, likely corrupt JPEG compressed data in first strip/tile; auto-correcting skipped");\n\t_TIFFfree(m.buffer);\n}', 'int _TIFFFillStriles( TIFF *tif )\n{\n#if defined(DEFER_STRILE_LOAD)\n        register TIFFDirectory *td = &tif->tif_dir;\n        int return_value = 1;\n        if( td->td_stripoffset != NULL )\n                return 1;\n        if( td->td_stripoffset_entry.tdir_count == 0 )\n                return 0;\n        if (!TIFFFetchStripThing(tif,&(td->td_stripoffset_entry),\n                                 td->td_nstrips,&td->td_stripoffset))\n        {\n                return_value = 0;\n        }\n        if (!TIFFFetchStripThing(tif,&(td->td_stripbytecount_entry),\n                                 td->td_nstrips,&td->td_stripbytecount))\n        {\n                return_value = 0;\n        }\n        _TIFFmemset( &(td->td_stripoffset_entry), 0, sizeof(TIFFDirEntry));\n        _TIFFmemset( &(td->td_stripbytecount_entry), 0, sizeof(TIFFDirEntry));\n\tif (tif->tif_dir.td_nstrips > 1 && return_value == 1 ) {\n\t\tuint32 strip;\n\t\ttif->tif_dir.td_stripbytecountsorted = 1;\n\t\tfor (strip = 1; strip < tif->tif_dir.td_nstrips; strip++) {\n\t\t\tif (tif->tif_dir.td_stripoffset[strip - 1] >\n\t\t\t    tif->tif_dir.td_stripoffset[strip]) {\n\t\t\t\ttif->tif_dir.td_stripbytecountsorted = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n        return return_value;\n#else\n        (void) tif;\n        return 1;\n#endif\n}', 'void*\n_TIFFmalloc(tmsize_t s)\n{\n        if (s == 0)\n                return ((void *) NULL);\n\treturn (malloc((size_t) s));\n}']