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

libtiff/tif_ojpeg.c:1699:1: start of procedure OJPEGReadHeaderInfoSecTablesQTable()
1697. }
1698. 
1699. static int
      ^
1700. OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)
1701. {

libtiff/tif_ojpeg.c:1702:2: 
1700. OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)
1701. {
1702. 	static const char module[]="OJPEGReadHeaderInfoSecTablesQTable";
       ^
1703. 	OJPEGState* sp=(OJPEGState*)tif->tif_data;
1704. 	uint8 m;

libtiff/tif_ojpeg.c:1703:2: 
1701. {
1702. 	static const char module[]="OJPEGReadHeaderInfoSecTablesQTable";
1703. 	OJPEGState* sp=(OJPEGState*)tif->tif_data;
       ^
1704. 	uint8 m;
1705. 	uint8 n;

libtiff/tif_ojpeg.c:1709:6: Taking false branch
1707. 	uint8* ob;
1708. 	uint32 p;
1709. 	if (sp->qtable_offset[0]==0)
           ^
1710. 	{
1711. 		TIFFErrorExt(tif->tif_clientdata,module,"Missing JPEG tables");

libtiff/tif_ojpeg.c:1714:2: 
1712. 		return(0);
1713. 	}
1714. 	sp->in_buffer_file_pos_log=0;
       ^
1715. 	for (m=0; m<sp->samples_per_pixel; m++)
1716. 	{

libtiff/tif_ojpeg.c:1715:7: 
1713. 	}
1714. 	sp->in_buffer_file_pos_log=0;
1715. 	for (m=0; m<sp->samples_per_pixel; m++)
            ^
1716. 	{
1717. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))

libtiff/tif_ojpeg.c:1715:12: Loop condition is true. Entering loop body
1713. 	}
1714. 	sp->in_buffer_file_pos_log=0;
1715. 	for (m=0; m<sp->samples_per_pixel; m++)
                 ^
1716. 	{
1717. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))

libtiff/tif_ojpeg.c:1717:8: Taking true branch
1715. 	for (m=0; m<sp->samples_per_pixel; m++)
1716. 	{
1717. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))
             ^
1718. 		{
1719. 			for (n=0; n<m-1; n++)

libtiff/tif_ojpeg.c:1717:38: Taking true branch
1715. 	for (m=0; m<sp->samples_per_pixel; m++)
1716. 	{
1717. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))
                                           ^
1718. 		{
1719. 			for (n=0; n<m-1; n++)

libtiff/tif_ojpeg.c:1719:9: 
1717. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))
1718. 		{
1719. 			for (n=0; n<m-1; n++)
              ^
1720. 			{
1721. 				if (sp->qtable_offset[m]==sp->qtable_offset[n])

libtiff/tif_ojpeg.c:1719:14: Loop condition is false. Leaving loop
1717. 		if ((sp->qtable_offset[m]!=0) && ((m==0) || (sp->qtable_offset[m]!=sp->qtable_offset[m-1])))
1718. 		{
1719. 			for (n=0; n<m-1; n++)
                   ^
1720. 			{
1721. 				if (sp->qtable_offset[m]==sp->qtable_offset[n])

libtiff/tif_ojpeg.c:1727:4: 
1725. 				}
1726. 			}
1727. 			oa=sizeof(uint32)+69;
         ^
1728. 			ob=_TIFFmalloc(oa);
1729. 			if (ob==0)

libtiff/tif_ojpeg.c:1728:4: 
1726. 			}
1727. 			oa=sizeof(uint32)+69;
1728. 			ob=_TIFFmalloc(oa);
         ^
1729. 			if (ob==0)
1730. 			{

libtiff/tif_unix.c:253:1: start of procedure _TIFFmalloc()
  251. #endif
  252. 
  253. void*
       ^
  254. _TIFFmalloc(tmsize_t s)
  255. {

libtiff/tif_unix.c:256:2: 
  254. _TIFFmalloc(tmsize_t s)
  255. {
  256. 	return (malloc((size_t) s));
        ^
  257. }
  258. 

libtiff/tif_unix.c:257:1: return from a call to _TIFFmalloc
  255. {
  256. 	return (malloc((size_t) s));
  257. }
       ^
  258. 
  259. void

libtiff/tif_ojpeg.c:1729:8: Taking false branch
1727. 			oa=sizeof(uint32)+69;
1728. 			ob=_TIFFmalloc(oa);
1729. 			if (ob==0)
             ^
1730. 			{
1731. 				TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");

libtiff/tif_ojpeg.c:1734:4: 
1732. 				return(0);
1733. 			}
1734. 			*(uint32*)ob=oa;
         ^
1735. 			ob[sizeof(uint32)]=255;
1736. 			ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;

libtiff/tif_ojpeg.c:1735:4: 
1733. 			}
1734. 			*(uint32*)ob=oa;
1735. 			ob[sizeof(uint32)]=255;
         ^
1736. 			ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;
1737. 			ob[sizeof(uint32)+2]=0;

libtiff/tif_ojpeg.c:1736:4: 
1734. 			*(uint32*)ob=oa;
1735. 			ob[sizeof(uint32)]=255;
1736. 			ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;
         ^
1737. 			ob[sizeof(uint32)+2]=0;
1738. 			ob[sizeof(uint32)+3]=67;

libtiff/tif_ojpeg.c:1737:4: 
1735. 			ob[sizeof(uint32)]=255;
1736. 			ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;
1737. 			ob[sizeof(uint32)+2]=0;
         ^
1738. 			ob[sizeof(uint32)+3]=67;
1739. 			ob[sizeof(uint32)+4]=m;

libtiff/tif_ojpeg.c:1738:4: 
1736. 			ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;
1737. 			ob[sizeof(uint32)+2]=0;
1738. 			ob[sizeof(uint32)+3]=67;
         ^
1739. 			ob[sizeof(uint32)+4]=m;
1740. 			TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET); 

libtiff/tif_ojpeg.c:1739:4: 
1737. 			ob[sizeof(uint32)+2]=0;
1738. 			ob[sizeof(uint32)+3]=67;
1739. 			ob[sizeof(uint32)+4]=m;
         ^
1740. 			TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET); 
1741. 			p=TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);

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

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

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

libtiff/tif_ojpeg.c:1743:5: 
1741. 			p=TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
1742. 			if (p!=64)
1743. 				return(0);
          ^
1744. 			sp->qtable[m]=ob;
1745. 			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=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=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\treturn (malloc((size_t) s));\n}']