Fix memory leak in Index::checkout