diff options
Diffstat (limited to 'src/list.c')
-rw-r--r-- | src/list.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -157,7 +157,7 @@ H_ATTR NUM list_length(const List * const restrict ls) { - return ls->len; + return (ls == NULL) ? 0 : ls->len; } BOOL @@ -231,7 +231,7 @@ List * array_to_list(void **array, NUM size) { List *ls = NULL; - + SAFE_MALLOC(List, ls, 1, return NULL;); ls->array = array; @@ -243,6 +243,8 @@ array_to_list(void **array, NUM size) void destroy_list(List *ls, BOOL all_free_p) { + if (ls == NULL) return; + if (all_free_p == 1) for (NUM i = 0; i < ls->len; i++) free(*(ls->array+i)); |