libtiff/tif_ojpeg.c:1785: error: Memory Leak
  memory dynamically allocated to `return` by call to `_TIFFmalloc()` at line 1770, column 7 is not reachable after line 1785, column 5.

libtiff/tif_ojpeg.c:1741:1: start of procedure OJPEGReadHeaderInfoSecTablesQTable()
1739. }
1740. 
1741. static int
      ^
1742. OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)
1743. {

libtiff/tif_ojpeg.c:1744:2: 
1742. OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)
1743. {
1744. 	static const char module[]="OJPEGReadHeaderInfoSecTablesQTable";
       ^
1745. 	OJPEGState* sp=(OJPEGState*)tif->tif_data;
1746. 	uint8 m;

libtiff/tif_ojpeg.c:1745:2: 
1743. {
1744. 	static const char module[]="OJPEGReadHeaderInfoSecTablesQTable";
1745. 	OJPEGState* sp=(OJPEGState*)tif->tif_data;
       ^
1746. 	uint8 m;
1747. 	uint8 n;

libtiff/tif_ojpeg.c:1751:6: Taking false branch
1749. 	uint8* ob;
1750. 	uint32 p;
1751. 	if (sp->qtable_offset[0]==0)
           ^
1752. 	{
1753. 		TIFFErrorExt(tif->tif_clientdata,module,"Missing JPEG tables");

libtiff/tif_ojpeg.c:1756:2: 
1754. 		return(0);
1755. 	}
1756. 	sp->in_buffer_file_pos_log=0;
       ^
1757. 	for (m=0; m<sp->samples_per_pixel; m++)
1758. 	{

libtiff/tif_ojpeg.c:1757:7: 
1755. 	}
1756. 	sp->in_buffer_file_pos_log=0;
1757. 	for (m=0; m<sp->samples_per_pixel; m++)
            ^
1758. 	{
1759. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))

libtiff/tif_ojpeg.c:1757:12: Loop condition is true. Entering loop body
1755. 	}
1756. 	sp->in_buffer_file_pos_log=0;
1757. 	for (m=0; m<sp->samples_per_pixel; m++)
                 ^
1758. 	{
1759. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))

libtiff/tif_ojpeg.c:1759:8: Taking true branch
1757. 	for (m=0; m<sp->samples_per_pixel; m++)
1758. 	{
1759. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))
             ^
1760. 		{
1761. 			for (n=0; n<m-1; n++)

libtiff/tif_ojpeg.c:1759:38: Taking true branch
1757. 	for (m=0; m<sp->samples_per_pixel; m++)
1758. 	{
1759. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))
                                           ^
1760. 		{
1761. 			for (n=0; n<m-1; n++)

libtiff/tif_ojpeg.c:1761:9: 
1759. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))
1760. 		{
1761. 			for (n=0; n<m-1; n++)
              ^
1762. 			{
1763. 				if (sp->qtable_offset[m]==sp->qtable_offset[n])

libtiff/tif_ojpeg.c:1761:14: Loop condition is false. Leaving loop
1759. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))
1760. 		{
1761. 			for (n=0; n<m-1; n++)
                   ^
1762. 			{
1763. 				if (sp->qtable_offset[m]==sp->qtable_offset[n])

libtiff/tif_ojpeg.c:1769:4: 
1767. 				}
1768. 			}
1769. 			oa=sizeof(uint32)+69;
         ^
1770. 			ob=_TIFFmalloc(oa);
1771. 			if (ob==0)

libtiff/tif_ojpeg.c:1770:4: 
1768. 			}
1769. 			oa=sizeof(uint32)+69;
1770. 			ob=_TIFFmalloc(oa);
         ^
1771. 			if (ob==0)
1772. 			{

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

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

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

libtiff/tif_unix.c:317:1: return from a call to _TIFFmalloc
  315. 
  316. 	return (malloc((size_t) s));
  317. }
       ^
  318. 
  319. void

libtiff/tif_ojpeg.c:1771:8: Taking false branch
1769. 			oa=sizeof(uint32)+69;
1770. 			ob=_TIFFmalloc(oa);
1771. 			if (ob==0)
             ^
1772. 			{
1773. 				TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");

libtiff/tif_ojpeg.c:1776:4: 
1774. 				return(0);
1775. 			}
1776. 			*(uint32*)ob=oa;
         ^
1777. 			ob[sizeof(uint32)]=255;
1778. 			ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;

libtiff/tif_ojpeg.c:1777:4: 
1775. 			}
1776. 			*(uint32*)ob=oa;
1777. 			ob[sizeof(uint32)]=255;
         ^
1778. 			ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;
1779. 			ob[sizeof(uint32)+2]=0;

libtiff/tif_ojpeg.c:1778:4: 
1776. 			*(uint32*)ob=oa;
1777. 			ob[sizeof(uint32)]=255;
1778. 			ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;
         ^
1779. 			ob[sizeof(uint32)+2]=0;
1780. 			ob[sizeof(uint32)+3]=67;

libtiff/tif_ojpeg.c:1779:4: 
1777. 			ob[sizeof(uint32)]=255;
1778. 			ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;
1779. 			ob[sizeof(uint32)+2]=0;
         ^
1780. 			ob[sizeof(uint32)+3]=67;
1781. 			ob[sizeof(uint32)+4]=m;

libtiff/tif_ojpeg.c:1780:4: 
1778. 			ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;
1779. 			ob[sizeof(uint32)+2]=0;
1780. 			ob[sizeof(uint32)+3]=67;
         ^
1781. 			ob[sizeof(uint32)+4]=m;
1782. 			TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET); 

libtiff/tif_ojpeg.c:1781:4: 
1779. 			ob[sizeof(uint32)+2]=0;
1780. 			ob[sizeof(uint32)+3]=67;
1781. 			ob[sizeof(uint32)+4]=m;
         ^
1782. 			TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET); 
1783. 			p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);

libtiff/tif_ojpeg.c:1782:4: Skipping __function_pointer__(): unresolved function pointer
1780. 			ob[sizeof(uint32)+3]=67;
1781. 			ob[sizeof(uint32)+4]=m;
1782. 			TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET); 
         ^
1783. 			p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
1784. 			if (p!=64)

libtiff/tif_ojpeg.c:1783:4: Skipping __function_pointer__(): unresolved function pointer
1781. 			ob[sizeof(uint32)+4]=m;
1782. 			TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET); 
1783. 			p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
         ^
1784. 			if (p!=64)
1785. 				return(0);

libtiff/tif_ojpeg.c:1784:8: Taking true branch
1782. 			TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET); 
1783. 			p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
1784. 			if (p!=64)
             ^
1785. 				return(0);
1786. 			sp->qtable[m]=ob;

libtiff/tif_ojpeg.c:1785:5: 
1783. 			p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
1784. 			if (p!=64)
1785. 				return(0);
          ^
1786. 			sp->qtable[m]=ob;
1787. 			sp->sof_tq[m]=m;

static int
OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)
{
	static const char module[]="OJPEGReadHeaderInfoSecTablesQTable";
	OJPEGState* sp=(OJPEGState*)tif->tif_data;
	uint8 m;
	uint8 n;
	uint32 oa;
	uint8* ob;
	uint32 p;
	if (sp->qtable_offset[0]==0)
	{
		TIFFErrorExt(tif->tif_clientdata,module,"Missing JPEG tables");
		return(0);
	}
	sp->in_buffer_file_pos_log=0;
	for (m=0; m<sp->samples_per_pixel; m++)
	{
		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))
		{
			for (n=0; n<m-1; n++)
			{
				if (sp->qtable_offset[m]==sp->qtable_offset[n])
				{
					TIFFErrorExt(tif->tif_clientdata,module,"Corrupt JpegQTables tag value");
					return(0);
				}
			}
			oa=sizeof(uint32)+69;
			ob=_TIFFmalloc(oa);
			if (ob==0)
			{
				TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
				return(0);
			}
			*(uint32*)ob=oa;
			ob[sizeof(uint32)]=255;
			ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;
			ob[sizeof(uint32)+2]=0;
			ob[sizeof(uint32)+3]=67;
			ob[sizeof(uint32)+4]=m;
			TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET);
			p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
			if (p!=64)
				return(0);
			sp->qtable[m]=ob;
			sp->sof_tq[m]=m;
		}
		else
			sp->sof_tq[m]=sp->sof_tq[m-1];
	}
	return(1);
}
['static int\nOJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)\n{\n\tstatic const char module[]="OJPEGReadHeaderInfoSecTablesQTable";\n\tOJPEGState* sp=(OJPEGState*)tif->tif_data;\n\tuint8 m;\n\tuint8 n;\n\tuint32 oa;\n\tuint8* ob;\n\tuint32 p;\n\tif (sp->qtable_offset[0]==0)\n\t{\n\t\tTIFFErrorExt(tif->tif_clientdata,module,"Missing JPEG tables");\n\t\treturn(0);\n\t}\n\tsp->in_buffer_file_pos_log=0;\n\tfor (m=0; m<sp->samples_per_pixel; m++)\n\t{\n\t\tif ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))\n\t\t{\n\t\t\tfor (n=0; n<m-1; n++)\n\t\t\t{\n\t\t\t\tif (sp->qtable_offset[m]==sp->qtable_offset[n])\n\t\t\t\t{\n\t\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,"Corrupt JpegQTables tag value");\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t}\n\t\t\toa=sizeof(uint32)+69;\n\t\t\tob=_TIFFmalloc(oa);\n\t\t\tif (ob==0)\n\t\t\t{\n\t\t\t\tTIFFErrorExt(tif->tif_clientdata,module,"Out of memory");\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\t*(uint32*)ob=oa;\n\t\t\tob[sizeof(uint32)]=255;\n\t\t\tob[sizeof(uint32)+1]=JPEG_MARKER_DQT;\n\t\t\tob[sizeof(uint32)+2]=0;\n\t\t\tob[sizeof(uint32)+3]=67;\n\t\t\tob[sizeof(uint32)+4]=m;\n\t\t\tTIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET);\n\t\t\tp=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);\n\t\t\tif (p!=64)\n\t\t\t\treturn(0);\n\t\t\tsp->qtable[m]=ob;\n\t\t\tsp->sof_tq[m]=m;\n\t\t}\n\t\telse\n\t\t\tsp->sof_tq[m]=sp->sof_tq[m-1];\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}']