Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-05-30 08:04:05 +0300
committerJunio C Hamano <gitster@pobox.com>2018-05-30 08:04:05 +0300
commit0abb9628932717f535f27d4652c07455389db5f3 (patch)
treeda86cd118048f59c22601cfadcd0fc0b7f2fdcad /repository.c
parent2f76ebc93ca6bfc2aba1be330aabe391a7d093d2 (diff)
parent74373b5f10e2e8720ad2ae8211811757601550fd (diff)
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)
Diffstat (limited to 'repository.c')
-rw-r--r--repository.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/repository.c b/repository.c
index beff3caa9e..02fe884603 100644
--- a/repository.c
+++ b/repository.c
@@ -238,7 +238,8 @@ void repo_clear(struct repository *repo)
if (repo->index) {
discard_index(repo->index);
- FREE_AND_NULL(repo->index);
+ if (repo->index != &the_index)
+ FREE_AND_NULL(repo->index);
}
}