memory_utils: adapt to new pointer error macros

parent 75f08c85
...@@ -52,8 +52,10 @@ define_cleanup_function(DIR *, closedir); ...@@ -52,8 +52,10 @@ define_cleanup_function(DIR *, closedir);
#define free_disarm(ptr) \ #define free_disarm(ptr) \
({ \ ({ \
if (!IS_ERR_OR_NULL(ptr)) { \
free(ptr); \ free(ptr); \
ptr = NULL; \ ptr = NULL; \
} \
}) })
static inline void free_disarm_function(void *ptr) static inline void free_disarm_function(void *ptr)
...@@ -64,7 +66,7 @@ static inline void free_disarm_function(void *ptr) ...@@ -64,7 +66,7 @@ static inline void free_disarm_function(void *ptr)
static inline void free_string_list(char **list) static inline void free_string_list(char **list)
{ {
if (list) { if (list && !IS_ERR(list)) {
for (int i = 0; list[i]; i++) for (int i = 0; list[i]; i++)
free(list[i]); free(list[i]);
free_disarm(list); free_disarm(list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment