tools/tiff2pdf.c:2107: error: Null Dereference
  pointer `buffer` last assigned on line 2105 could be null and is dereferenced by call to `memset()` at line 2107, column 25.

tools/tiff2pdf.c:2044:1: start of procedure t2p_readwrite_pdf_image()
2042. */
2043. 
2044. tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
      ^
2045. 
2046. 	tsize_t written=0;

tools/tiff2pdf.c:2046:2: 
2044. tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
2045. 
2046. 	tsize_t written=0;
       ^
2047. 	unsigned char* buffer=NULL;
2048. 	unsigned char* samplebuffer=NULL;

tools/tiff2pdf.c:2047:2: 
2045. 
2046. 	tsize_t written=0;
2047. 	unsigned char* buffer=NULL;
       ^
2048. 	unsigned char* samplebuffer=NULL;
2049. 	tsize_t bufferoffset=0;

tools/tiff2pdf.c:2048:2: 
2046. 	tsize_t written=0;
2047. 	unsigned char* buffer=NULL;
2048. 	unsigned char* samplebuffer=NULL;
       ^
2049. 	tsize_t bufferoffset=0;
2050. 	tsize_t samplebufferoffset=0;

tools/tiff2pdf.c:2049:2: 
2047. 	unsigned char* buffer=NULL;
2048. 	unsigned char* samplebuffer=NULL;
2049. 	tsize_t bufferoffset=0;
       ^
2050. 	tsize_t samplebufferoffset=0;
2051. 	tsize_t read=0;

tools/tiff2pdf.c:2050:2: 
2048. 	unsigned char* samplebuffer=NULL;
2049. 	tsize_t bufferoffset=0;
2050. 	tsize_t samplebufferoffset=0;
       ^
2051. 	tsize_t read=0;
2052. 	tstrip_t i=0;

tools/tiff2pdf.c:2051:2: 
2049. 	tsize_t bufferoffset=0;
2050. 	tsize_t samplebufferoffset=0;
2051. 	tsize_t read=0;
       ^
2052. 	tstrip_t i=0;
2053. 	tstrip_t j=0;

tools/tiff2pdf.c:2052:2: 
2050. 	tsize_t samplebufferoffset=0;
2051. 	tsize_t read=0;
2052. 	tstrip_t i=0;
       ^
2053. 	tstrip_t j=0;
2054. 	tstrip_t stripcount=0;

tools/tiff2pdf.c:2053:2: 
2051. 	tsize_t read=0;
2052. 	tstrip_t i=0;
2053. 	tstrip_t j=0;
       ^
2054. 	tstrip_t stripcount=0;
2055. 	tsize_t stripsize=0;

tools/tiff2pdf.c:2054:2: 
2052. 	tstrip_t i=0;
2053. 	tstrip_t j=0;
2054. 	tstrip_t stripcount=0;
       ^
2055. 	tsize_t stripsize=0;
2056. 	tsize_t sepstripcount=0;

tools/tiff2pdf.c:2055:2: 
2053. 	tstrip_t j=0;
2054. 	tstrip_t stripcount=0;
2055. 	tsize_t stripsize=0;
       ^
2056. 	tsize_t sepstripcount=0;
2057. 	tsize_t sepstripsize=0;

tools/tiff2pdf.c:2056:2: 
2054. 	tstrip_t stripcount=0;
2055. 	tsize_t stripsize=0;
2056. 	tsize_t sepstripcount=0;
       ^
2057. 	tsize_t sepstripsize=0;
2058. #ifdef OJPEG_SUPPORT

tools/tiff2pdf.c:2057:2: 
2055. 	tsize_t stripsize=0;
2056. 	tsize_t sepstripcount=0;
2057. 	tsize_t sepstripsize=0;
       ^
2058. #ifdef OJPEG_SUPPORT
2059. 	toff_t inputoffset=0;

tools/tiff2pdf.c:2059:2: 
2057. 	tsize_t sepstripsize=0;
2058. #ifdef OJPEG_SUPPORT
2059. 	toff_t inputoffset=0;
       ^
2060. 	uint16 h_samp=1;
2061. 	uint16 v_samp=1;

tools/tiff2pdf.c:2060:2: 
2058. #ifdef OJPEG_SUPPORT
2059. 	toff_t inputoffset=0;
2060. 	uint16 h_samp=1;
       ^
2061. 	uint16 v_samp=1;
2062. 	uint16 ri=1;

tools/tiff2pdf.c:2061:2: 
2059. 	toff_t inputoffset=0;
2060. 	uint16 h_samp=1;
2061. 	uint16 v_samp=1;
       ^
2062. 	uint16 ri=1;
2063. 	uint32 rows=0;

tools/tiff2pdf.c:2062:2: 
2060. 	uint16 h_samp=1;
2061. 	uint16 v_samp=1;
2062. 	uint16 ri=1;
       ^
2063. 	uint32 rows=0;
2064. #endif

tools/tiff2pdf.c:2063:2: 
2061. 	uint16 v_samp=1;
2062. 	uint16 ri=1;
2063. 	uint32 rows=0;
       ^
2064. #endif
2065. #ifdef JPEG_SUPPORT

tools/tiff2pdf.c:2070:2: 
2068. 	uint64* sbc;
2069. 	unsigned char* stripbuffer;
2070. 	tsize_t striplength=0;
       ^
2071. 	uint32 max_striplength=0;
2072. #endif

tools/tiff2pdf.c:2071:2: 
2069. 	unsigned char* stripbuffer;
2070. 	tsize_t striplength=0;
2071. 	uint32 max_striplength=0;
       ^
2072. #endif
2073. 

tools/tiff2pdf.c:2074:5: Taking true branch
2072. #endif
2073. 
2074. 	if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){
          ^
2075. #ifdef CCITT_SUPPORT
2076. 		if(t2p->pdf_compression == T2P_COMPRESS_G4){

tools/tiff2pdf.c:2076:6: Taking false branch
2074. 	if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){
2075. #ifdef CCITT_SUPPORT
2076. 		if(t2p->pdf_compression == T2P_COMPRESS_G4){
           ^
2077. 			buffer = (unsigned char*)
2078. 				_TIFFmalloc(t2p->tiff_datasize);

tools/tiff2pdf.c:2104:7: Taking true branch
2102. #endif
2103. #ifdef ZIP_SUPPORT
2104. 		if (t2p->pdf_compression == T2P_COMPRESS_ZIP) {
            ^
2105. 			buffer = (unsigned char*)
2106. 				_TIFFmalloc(t2p->tiff_datasize);

tools/tiff2pdf.c:2105:4: 
2103. #ifdef ZIP_SUPPORT
2104. 		if (t2p->pdf_compression == T2P_COMPRESS_ZIP) {
2105. 			buffer = (unsigned char*)
         ^
2106. 				_TIFFmalloc(t2p->tiff_datasize);
2107.                         memset(buffer, 0, t2p->tiff_datasize);

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

tools/tiff2pdf.c:2107:25: 
2105. 			buffer = (unsigned char*)
2106. 				_TIFFmalloc(t2p->tiff_datasize);
2107.                         memset(buffer, 0, t2p->tiff_datasize);
                              ^
2108. 			if(buffer == NULL){
2109. 				TIFFError(TIFF2PDF_MODULE, 
