Commit 7b057f53 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

curl_dofree: allow free(NULL)

Previously this memdebug free() replacement didn't properly work with a
NULL argument which has made us write code that avoids calling
free(NULL) - which causes some extra nuisance and unnecessary code.
Starting now, we should allow free(NULL) even when built with the
memdebug system enabled.

free(NULL) is permitted by POSIX
parent 2dd9bfc5
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -314,7 +314,7 @@ void curl_dofree(void *ptr, int line, const char *source)
{
  struct memdebug *mem;

  assert(ptr != NULL);
  if(ptr) {

#ifdef __INTEL_COMPILER
#  pragma warning(push)
@@ -333,6 +333,7 @@ void curl_dofree(void *ptr, int line, const char *source)

    /* free for real */
    (Curl_cfree)(mem);
  }

  if(source)
    curl_memlog("MEM %s:%d free(%p)\n", source, line, (void *)ptr);