@@ -285,6 +285,8 @@ void __free_debug (void * mem, const char * file, int line)
void free (void * mem)
#endif
{
+ if (!mem)
+ return;
if (MEMORY_MIGRATED(mem)) {
INC_PROFILE_OCCURENCE(free_migrated);
return;
@@ -373,8 +373,7 @@ int free_config (struct config_store * store)
struct config * e, * n;
listp_for_each_entry_safe(e, n, &store->entries, list) {
- if (e->buf)
- store->free(e->buf);
+ store->free(e->buf);
store->free(e);
}
@@ -71,6 +71,8 @@ static inline void * __malloc (int size)
static inline void __free (void * addr, int size)
+ if (!addr)
#if STATIC_SLAB == 1
if (addr >= (void *)mem_pool && addr < mem_pool_end)
@@ -168,6 +170,8 @@ void * calloc (size_t nmem, size_t size)
void free (void * ptr)
+ if (!ptr)
#if PROFILING == 1
unsigned long before_slab = _DkSystemTimeQuery();