From 97518da1df276cd0019fd31011a224f0a0736a8d Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 19 May 2018 23:42:48 +0200 Subject: [PATCH] Fix collections list_pop_front bug. * Thanks to Rocky Song for finding the bug. --- src/omv/img/collections.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/omv/img/collections.c b/src/omv/img/collections.c index 5c7a79e0c..fcfcc3b83 100644 --- a/src/omv/img/collections.c +++ b/src/omv/img/collections.c @@ -294,7 +294,9 @@ void list_pop_front(list_t *ptr, void *data) memcpy(data, tmp->data, ptr->data_len); } - tmp->next_ptr->prev_ptr = NULL; + if (tmp->next_ptr) { + tmp->next_ptr->prev_ptr = NULL; + } ptr->head_ptr = tmp->next_ptr; ptr->size -= 1; xfree(tmp);