Merge branch 'nd/repo-clear-keep-the-index'

the_repository->index is not a allocated piece of memory but
repo_clear() indiscriminately attempted to free(3) it, which has
been corrected.

* nd/repo-clear-keep-the-index:
  repository: fix free problem with repo_clear(the_repository)
This commit is contained in:
Junio C Hamano 2018-05-30 14:04:05 +09:00
commit 0abb962893

View File

@ -238,6 +238,7 @@ void repo_clear(struct repository *repo)
if (repo->index) {
discard_index(repo->index);
if (repo->index != &the_index)
FREE_AND_NULL(repo->index);
}
}