tools/tiffcrop.c:6987: error: Null Dereference
  pointer `sect_buff` last assigned on line 6985 could be null and is dereferenced by call to `_TIFFmemset()` at line 6987, column 5.

tools/tiffcrop.c:6974:1: start of procedure createImageSection()
6972. 
6973. /* Create a buffer to write one section at a time */
6974. static int
      ^
6975. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)
6976.   {

tools/tiffcrop.c:6977:3: 
6975. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)
6976.   {
6977.   unsigned  char *sect_buff = NULL;
        ^
6978.   unsigned  char *new_buff  = NULL;
6979.   static    uint32  prev_sectsize = 0;

tools/tiffcrop.c:6978:3: 
6976.   {
6977.   unsigned  char *sect_buff = NULL;
6978.   unsigned  char *new_buff  = NULL;
        ^
6979.   static    uint32  prev_sectsize = 0;
6980.   

tools/tiffcrop.c:6979:3: 
6977.   unsigned  char *sect_buff = NULL;
6978.   unsigned  char *new_buff  = NULL;
6979.   static    uint32  prev_sectsize = 0;
        ^
6980.   
6981.   sect_buff = *sect_buff_ptr;

tools/tiffcrop.c:6981:3: 
6979.   static    uint32  prev_sectsize = 0;
6980.   
6981.   sect_buff = *sect_buff_ptr;
        ^
6982. 
6983.   if (!sect_buff)

tools/tiffcrop.c:6983:8: Taking true branch
6981.   sect_buff = *sect_buff_ptr;
6982. 
6983.   if (!sect_buff)
             ^
6984.     {
6985.     sect_buff = (unsigned char *)_TIFFmalloc(sectsize);

tools/tiffcrop.c:6985:5: 
6983.   if (!sect_buff)
6984.     {
6985.     sect_buff = (unsigned char *)_TIFFmalloc(sectsize);
          ^
6986.     *sect_buff_ptr = sect_buff;
6987.     _TIFFmemset(sect_buff, 0, sectsize);

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/tiffcrop.c:6986:5: 
6984.     {
6985.     sect_buff = (unsigned char *)_TIFFmalloc(sectsize);
6986.     *sect_buff_ptr = sect_buff;
          ^
6987.     _TIFFmemset(sect_buff, 0, sectsize);
6988.     }

tools/tiffcrop.c:6987:5: 
6985.     sect_buff = (unsigned char *)_TIFFmalloc(sectsize);
6986.     *sect_buff_ptr = sect_buff;
6987.     _TIFFmemset(sect_buff, 0, sectsize);
          ^
6988.     }
6989.   else

libtiff/tif_unix.c:271:1: start of procedure _TIFFmemset()
  269. }
  270. 
  271. void
       ^
  272. _TIFFmemset(void* p, int v, tmsize_t c)
  273. {

libtiff/tif_unix.c:274:2: 
  272. _TIFFmemset(void* p, int v, tmsize_t c)
  273. {
  274. 	memset(p, v, (size_t) c);
        ^
  275. }
  276. 

libtiff/tif_unix.c:275:1: return from a call to _TIFFmemset
  273. {
  274. 	memset(p, v, (size_t) c);
  275. }
       ^
  276. 
  277. void

static int
createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)
  {
  unsigned  char *sect_buff = NULL;
  unsigned  char *new_buff  = NULL;
  static    uint32  prev_sectsize = 0;
  sect_buff = *sect_buff_ptr;
  if (!sect_buff)
    {
    sect_buff = (unsigned char *)_TIFFmalloc(sectsize);
    *sect_buff_ptr = sect_buff;
    _TIFFmemset(sect_buff, 0, sectsize);
    }
  else
    {
    if (prev_sectsize < sectsize)
      {
      new_buff = _TIFFrealloc(sect_buff, sectsize);
      if (!new_buff)
        {
	free (sect_buff);
        sect_buff = (unsigned char *)_TIFFmalloc(sectsize);
        }
      else
        sect_buff = new_buff;
      _TIFFmemset(sect_buff, 0, sectsize);
      }
    }
  if (!sect_buff)
    {
    TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");
    return (-1);
    }
  prev_sectsize = sectsize;
  *sect_buff_ptr = sect_buff;
  return (0);
  }
['static int\ncreateImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)\n  {\n  unsigned  char *sect_buff = NULL;\n  unsigned  char *new_buff  = NULL;\n  static    uint32  prev_sectsize = 0;\n  sect_buff = *sect_buff_ptr;\n  if (!sect_buff)\n    {\n    sect_buff = (unsigned char *)_TIFFmalloc(sectsize);\n    *sect_buff_ptr = sect_buff;\n    _TIFFmemset(sect_buff, 0, sectsize);\n    }\n  else\n    {\n    if (prev_sectsize < sectsize)\n      {\n      new_buff = _TIFFrealloc(sect_buff, sectsize);\n      if (!new_buff)\n        {\n\tfree (sect_buff);\n        sect_buff = (unsigned char *)_TIFFmalloc(sectsize);\n        }\n      else\n        sect_buff = new_buff;\n      _TIFFmemset(sect_buff, 0, sectsize);\n      }\n    }\n  if (!sect_buff)\n    {\n    TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");\n    return (-1);\n    }\n  prev_sectsize = sectsize;\n  *sect_buff_ptr = sect_buff;\n  return (0);\n  }', 'void*\n_TIFFmalloc(tmsize_t s)\n{\n\treturn (malloc((size_t) s));\n}', 'void\n_TIFFmemset(void* p, int v, tmsize_t c)\n{\n\tmemset(p, v, (size_t) c);\n}']