do not discard elements if realloc() fails