fix memory corruption in list_remove
This commit is contained in:
2
list.c
2
list.c
@ -54,6 +54,8 @@ bool list_remove(struct list *list, void *data)
|
|||||||
if (cur->data == data) {
|
if (cur->data == data) {
|
||||||
if (cur == list->head) {
|
if (cur == list->head) {
|
||||||
list->head = next;
|
list->head = next;
|
||||||
|
} else {
|
||||||
|
prev->next = next;
|
||||||
}
|
}
|
||||||
if (cur == list->tail) {
|
if (cur == list->tail) {
|
||||||
list->tail = prev;
|
list->tail = prev;
|
||||||
|
Reference in New Issue
Block a user