index-pack: fix allocation of sorted_by_pos array