Fix memory leak in pkg-repo.