alloc_wrappers: make free safe by not freeing null ptrs
This commit is contained in:
parent
ec3de83413
commit
79ada91006
@ -18,9 +18,10 @@
|
|||||||
|
|
||||||
#define cdo_free(ptr) do { \
|
#define cdo_free(ptr) do { \
|
||||||
if (!ptr) { \
|
if (!ptr) { \
|
||||||
LOG_WARNING("Freeing NULL pointer."); \
|
LOG_WARNING("Trying to free NULL pointer. Skipping..."); \
|
||||||
|
} else { \
|
||||||
|
free(ptr); \
|
||||||
} \
|
} \
|
||||||
free(ptr); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define cdo_calloc(nmemb, size) ((void*)({ \
|
#define cdo_calloc(nmemb, size) ((void*)({ \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user