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

libtiff/tif_jpeg.c:758:1: start of procedure JPEGFixupTagsSubsampling()
756. #ifdef CHECK_JPEG_YCBCR_SUBSAMPLING
757. 
758. static void
     ^
759. JPEGFixupTagsSubsampling(TIFF* tif)
760. {

libtiff/tif_jpeg.c:781:2: 
779. 	 * Joris Van Damme, May 2007
780. 	 */
781. 	static const char module[] = "JPEGFixupTagsSubsampling";
      ^
782. 	struct JPEGFixupTagsSubsamplingData m;
783. 

libtiff/tif_jpeg.c:784:9: 
782. 	struct JPEGFixupTagsSubsamplingData m;
783. 
784.         _TIFFFillStriles( tif );
             ^
785.         
786.         if( tif->tif_dir.td_stripbytecount == NULL

libtiff/tif_dirread.c:5941:1: start of procedure _TIFFFillStriles()
  5939. 
  5940. 
  5941. int _TIFFFillStriles( TIFF *tif )
        ^
  5942. {
  5943.     return _TIFFFillStrilesInternal( tif, 1 );

libtiff/tif_dirread.c:5943:5: 
  5941. int _TIFFFillStriles( TIFF *tif )
  5942. {
  5943.     return _TIFFFillStrilesInternal( tif, 1 );
            ^
  5944. }
  5945. 

libtiff/tif_dirread.c:5946:1: start of procedure _TIFFFillStrilesInternal()
    5944. }
    5945. 
    5946. static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount )
          ^
    5947. {
    5948. #if defined(DEFER_STRILE_LOAD)

libtiff/tif_dirread.c:5989:9: 
    5987.         return return_value;
    5988. #else /* !defined(DEFER_STRILE_LOAD) */
    5989.         (void) tif;
                  ^
    5990.         (void) loadStripByteCount;
    5991.         return 1;

libtiff/tif_dirread.c:5990:9: 
    5988. #else /* !defined(DEFER_STRILE_LOAD) */
    5989.         (void) tif;
    5990.         (void) loadStripByteCount;
                  ^
    5991.         return 1;
    5992. #endif 

libtiff/tif_dirread.c:5991:9: 
    5989.         (void) tif;
    5990.         (void) loadStripByteCount;
    5991.         return 1;
                  ^
    5992. #endif 
    5993. }

libtiff/tif_dirread.c:5993:1: return from a call to _TIFFFillStrilesInternal
    5991.         return 1;
    5992. #endif 
    5993. }
          ^
    5994. 
    5995. 

libtiff/tif_dirread.c:5944:1: return from a call to _TIFFFillStriles
  5942. {
  5943.     return _TIFFFillStrilesInternal( tif, 1 );
  5944. }
        ^
  5945. 
  5946. static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount )

libtiff/tif_jpeg.c:786:13: Taking false branch
784.         _TIFFFillStriles( tif );
785.         
786.         if( tif->tif_dir.td_stripbytecount == NULL
                 ^
787.             || tif->tif_dir.td_stripoffset == NULL
788.             || tif->tif_dir.td_stripbytecount[0] == 0 )

libtiff/tif_jpeg.c:787:16: Taking false branch
785.         
786.         if( tif->tif_dir.td_stripbytecount == NULL
787.             || tif->tif_dir.td_stripoffset == NULL
                    ^
788.             || tif->tif_dir.td_stripbytecount[0] == 0 )
789.         {

libtiff/tif_jpeg.c:788:16: Taking false branch
786.         if( tif->tif_dir.td_stripbytecount == NULL
787.             || tif->tif_dir.td_stripoffset == NULL
788.             || tif->tif_dir.td_stripbytecount[0] == 0 )
                    ^
789.         {
790.             /* Do not even try to check if the first strip/tile does not

libtiff/tif_jpeg.c:796:2: 
794.         }
795. 
796. 	m.tif=tif;
      ^
797. 	m.buffersize=2048;
798. 	m.buffer=_TIFFmalloc(m.buffersize);

libtiff/tif_jpeg.c:797:2: 
795. 
796. 	m.tif=tif;
797. 	m.buffersize=2048;
      ^
798. 	m.buffer=_TIFFmalloc(m.buffersize);
799. 	if (m.buffer==NULL)

libtiff/tif_jpeg.c:798:2: 
796. 	m.tif=tif;
797. 	m.buffersize=2048;
798. 	m.buffer=_TIFFmalloc(m.buffersize);
      ^
799. 	if (m.buffer==NULL)
800. 	{

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_jpeg.c:799:6: Taking false branch
797. 	m.buffersize=2048;
798. 	m.buffer=_TIFFmalloc(m.buffersize);
799. 	if (m.buffer==NULL)
          ^
800. 	{
801. 		TIFFWarningExt(tif->tif_clientdata,module,

libtiff/tif_jpeg.c:805:2: 
803. 		return;
804. 	}
805. 	m.buffercurrentbyte=NULL;
      ^
806. 	m.bufferbytesleft=0;
807. 	m.fileoffset=tif->tif_dir.td_stripoffset[0];

libtiff/tif_jpeg.c:806:2: 
804. 	}
805. 	m.buffercurrentbyte=NULL;
806. 	m.bufferbytesleft=0;
      ^
807. 	m.fileoffset=tif->tif_dir.td_stripoffset[0];
808. 	m.filepositioned=0;

libtiff/tif_jpeg.c:807:2: 
805. 	m.buffercurrentbyte=NULL;
806. 	m.bufferbytesleft=0;
807. 	m.fileoffset=tif->tif_dir.td_stripoffset[0];
      ^
808. 	m.filepositioned=0;
809. 	m.filebytesleft=tif->tif_dir.td_stripbytecount[0];

libtiff/tif_jpeg.c:808:2: 
806. 	m.bufferbytesleft=0;
807. 	m.fileoffset=tif->tif_dir.td_stripoffset[0];
808. 	m.filepositioned=0;
      ^
809. 	m.filebytesleft=tif->tif_dir.td_stripbytecount[0];
810. 	if (!JPEGFixupTagsSubsamplingSec(&m))

libtiff/tif_jpeg.c:809:2: 
807. 	m.fileoffset=tif->tif_dir.td_stripoffset[0];
808. 	m.filepositioned=0;
809. 	m.filebytesleft=tif->tif_dir.td_stripbytecount[0];
      ^
810. 	if (!JPEGFixupTagsSubsamplingSec(&m))
811. 		TIFFWarningExt(tif->tif_clientdata,module,

libtiff/tif_jpeg.c:810:7: Skipping JPEGFixupTagsSubsamplingSec(): empty list of specs
808. 	m.filepositioned=0;
809. 	m.filebytesleft=tif->tif_dir.td_stripbytecount[0];
810. 	if (!JPEGFixupTagsSubsamplingSec(&m))
           ^
811. 		TIFFWarningExt(tif->tif_clientdata,module,
812. 		    "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    return _TIFFFillStrilesInternal( tif, 1 );\n}', 'static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount )\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 (loadStripByteCount &&\n            !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        (void) loadStripByteCount;\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}']