summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-04-26 15:39:09 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-04-26 15:39:09 +0900
commit3961c516990e99f648981918a95ab77bde5a0f37 (patch)
tree1d29c23ae2e32984eac993ae509a23dcbf1e47bc /read-cache.c
parentMerge branch 'jk/war-on-git-path' (diff)
parentread-cache: avoid using git_path() in freshen_shared_index() (diff)
downloadtgif-3961c516990e99f648981918a95ab77bde5a0f37.tar.xz
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()
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c
index d8c657d6a7..b3d0f3c30b 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)