Explorar o código

-add NULL check

Christian Grothoff %!s(int64=3) %!d(string=hai) anos
pai
achega
b0c9eac44e
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      src/util/common_allocation.c

+ 5 - 1
src/util/common_allocation.c

@@ -327,8 +327,12 @@ GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber)
  * @param linenumber where in the code was the call to GNUNET_free()
  */
 void
-GNUNET_xfree_ (void *ptr, const char *filename, int linenumber)
+GNUNET_xfree_ (void *ptr,
+               const char *filename,
+               int linenumber)
 {
+  if (NULL == ptr)
+    return;
 #ifdef W32_MEM_LIMIT
   ptr = &((size_t *) ptr)[-1];
   mem_used -= *((size_t *) ptr);