array: Fix removal of elements in the second half of an array
Memory beyond the end of the array was moved when array elements in the second half of an array were removed. Fixes #548.
This commit is contained in:
parent
0ab7d5f1f9
commit
11f31ceb6a
|
@ -141,7 +141,7 @@ static void remove_tail(array_t *array, int idx)
|
|||
/* move all items after idx one down */
|
||||
memmove(array->data + get_size(array, idx + array->head),
|
||||
array->data + get_size(array, idx + array->head + 1),
|
||||
get_size(array, array->count - idx));
|
||||
get_size(array, array->count - 1 - idx));
|
||||
array->count--;
|
||||
array->tail++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue