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

tools/tiffcrop.c:7328:1: start of procedure createImageSection()
7326. 
7327. /* Create a buffer to write one section at a time */
7328. static int
      ^
7329. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)
7330.   {

tools/tiffcrop.c:7331:3: 
7329. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)
7330.   {
7331.   unsigned  char *sect_buff = NULL;
        ^
7332.   unsigned  char *new_buff  = NULL;
7333.   static    uint32  prev_sectsize = 0;

tools/tiffcrop.c:7332:3: 
7330.   {
7331.   unsigned  char *sect_buff = NULL;
7332.   unsigned  char *new_buff  = NULL;
        ^
7333.   static    uint32  prev_sectsize = 0;
7334.   

tools/tiffcrop.c:7333:3: 
7331.   unsigned  char *sect_buff = NULL;
7332.   unsigned  char *new_buff  = NULL;
7333.   static    uint32  prev_sectsize = 0;
        ^
7334.   
7335.   sect_buff = *sect_buff_ptr;

tools/tiffcrop.c:7335:3: 
7333.   static    uint32  prev_sectsize = 0;
7334.   
7335.   sect_buff = *sect_buff_ptr;
        ^
7336. 
7337.   if (!sect_buff)

tools/tiffcrop.c:7337:8: Taking false branch
7335.   sect_buff = *sect_buff_ptr;
7336. 
7337.   if (!sect_buff)
             ^
7338.     {
7339.     sect_buff = (unsigned char *)_TIFFmalloc(sectsize);

tools/tiffcrop.c:7345:9: Taking true branch
7343.   else
7344.     {
7345.     if (prev_sectsize < sectsize)
              ^
7346.       {
7347.       new_buff = _TIFFrealloc(sect_buff, sectsize);

tools/tiffcrop.c:7347:7: 
7345.     if (prev_sectsize < sectsize)
7346.       {
7347.       new_buff = _TIFFrealloc(sect_buff, sectsize);
            ^
7348.       if (!new_buff)
7349.         {

libtiff/tif_unix.c:331:1: start of procedure _TIFFrealloc()
  329. }
  330. 
  331. void*
       ^
  332. _TIFFrealloc(void* p, tmsize_t s)
  333. {

libtiff/tif_unix.c:334:2: 
  332. _TIFFrealloc(void* p, tmsize_t s)
  333. {
  334. 	return (realloc(p, (size_t) s));
        ^
  335. }
  336. 

libtiff/tif_unix.c:335:1: return from a call to _TIFFrealloc
  333. {
  334. 	return (realloc(p, (size_t) s));
  335. }
       ^
  336. 
  337. void

tools/tiffcrop.c:7348:12: Taking true branch
7346.       {
7347.       new_buff = _TIFFrealloc(sect_buff, sectsize);
7348.       if (!new_buff)
                 ^
7349.         {
7350. 	free (sect_buff);

tools/tiffcrop.c:7350:2: 
7348.       if (!new_buff)
7349.         {
7350. 	free (sect_buff);
       ^
7351.         sect_buff = (unsigned char *)_TIFFmalloc(sectsize);
7352.         }

tools/tiffcrop.c:7351:9: 
7349.         {
7350. 	free (sect_buff);
7351.         sect_buff = (unsigned char *)_TIFFmalloc(sectsize);
              ^
7352.         }
7353.       else

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)

tools/tiffcrop.c:7356:7: 
7354.         sect_buff = new_buff;
7355. 
7356.       _TIFFmemset(sect_buff, 0, sectsize);
            ^
7357.       }
7358.     }

libtiff/tif_unix.c:337:1: start of procedure _TIFFmemset()
  335. }
  336. 
  337. void
       ^
  338. _TIFFmemset(void* p, int v, tmsize_t c)
  339. {

libtiff/tif_unix.c:340:2: 
  338. _TIFFmemset(void* p, int v, tmsize_t c)
  339. {
  340. 	memset(p, v, (size_t) c);
        ^
  341. }
  342. 

libtiff/tif_unix.c:341:1: return from a call to _TIFFmemset
  339. {
  340. 	memset(p, v, (size_t) c);
  341. }
       ^
  342. 
  343. 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_TIFFrealloc(void* p, tmsize_t s)\n{\n\treturn (realloc(p, (size_t) s));\n}', 'void*\n_TIFFmalloc(tmsize_t s)\n{\n        if (s == 0)\n                return ((void *) NULL);\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}']