summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-04-26 06:39:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-26 06:39:09 (GMT)
commit3961c516990e99f648981918a95ab77bde5a0f37 (patch)
tree1d29c23ae2e32984eac993ae509a23dcbf1e47bc
parentb80f629f5bcf798a3c9b37651d2369ad555e7382 (diff)
parentccef2bb5fa752fac9351cabc61c1362c85d620ee (diff)
downloadgit-3961c516990e99f648981918a95ab77bde5a0f37.zip
git-3961c516990e99f648981918a95ab77bde5a0f37.tar.gz
git-3961c516990e99f648981918a95ab77bde5a0f37.tar.bz2
Merge branch 'cc/split-index-config'
The split-index code configuration code used an unsafe git_path() function without copying its result out. * cc/split-index-config: read-cache: avoid using git_path() in freshen_shared_index()
-rw-r--r--read-cache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c
index d8c657d..b3d0f3c 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1824,9 +1824,10 @@ unmap:
*/
static void freshen_shared_index(char *base_sha1_hex, int warn)
{
- const char *shared_index = git_path("sharedindex.%s", base_sha1_hex);
+ char *shared_index = git_pathdup("sharedindex.%s", base_sha1_hex);
if (!check_and_freshen_file(shared_index, 1) && warn)
warning("could not freshen shared index '%s'", shared_index);
+ free(shared_index);
}
int read_index_from(struct index_state *istate, const char *path)