Bugfix in the free function. The space for end_indexes is now freed.