The following fragment:

   *temp = '\0';  /* mark line end, strip \n */
   cursize = temp - buffer;
   if (NULL == (temp = realloc(buffer, (size_t)cursize + 1))) {
      free(buffer);  /* fouled somehow */
      return NULL;

temp and buffer are char *, cursize is int.

results in:

ggets.c(43,12): Dead storage buffer passed as out parameter to
  free: buffer Memory is used after it has been released (either
  by passing as an only param or assigning to an only global).
  (Use -usereleased to inhibit warning)
   ggets.c(42,32): Storage buffer is released

The error would be failure to free buffer, which is local.

Also splint fails to warn about failure to include string.h when
using strchr().  However gcc 3.1 does.

   Available for consulting/temporary embedded and systems.
   <>  USE worldnet address!

Reply via email to