Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'nd/repo-clear-keep-the-index'
author
Junio C Hamano
<gitster@pobox.com>
Wed, 30 May 2018 05:04:05 +0000
(14:04 +0900)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 30 May 2018 05:04:05 +0000
(14:04 +0900)
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)
repository.c
patch
|
blob
|
history
raw
(from parent 1:
2f76ebc
)
diff --git
a/repository.c
b/repository.c
index beff3caa9e24a902e560372cdab3c337769c7c89..02fe884603df56ea0996121152b7640afb56a48f 100644
(file)
--- 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);
}
}