diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-08-07 21:55:22 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-08-07 21:55:22 +0100 |
commit | 6932ab51971d40966d4d8aa473c15c10899e4763 (patch) | |
tree | 3ded34c2df6609d2fe5e8c5d7a8940efb202316a | |
parent | c0f1d73df3fef83cb6a60825c08620de0ded39d5 (diff) | |
download | imv-6932ab51971d40966d4d8aa473c15c10899e4763.tar.gz |
list: Fix memory corruption bug
-rw-r--r-- | src/list.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -48,7 +48,7 @@ void list_remove(struct list *list, size_t index) return; } - memmove(&list->items[index], &list->items[index + 1], list->len - index); + memmove(&list->items[index], &list->items[index + 1], sizeof(void*) * (list->len - index)); list->len -= 1; } @@ -61,7 +61,7 @@ void list_insert(struct list *list, size_t index, void *item) index = list->len; } - memmove(&list->items[index + 1], &list->items[index], list->len - index); + memmove(&list->items[index + 1], &list->items[index], sizeof(void*) * (list->len - index)); list->items[index] = item; list->len += 1; } |