summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-03-19 15:25:37 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-03-19 15:25:37 -0700
commit1dd4e7452295618b20703deffc4241bf7dd4be4f (patch)
treea8390c1f3eafd563988d9c2fafe8ad680d7ecc4b /unpack-trees.c
parentMerge branch 'jk/bisect-peel-tag-fix' (diff)
parentfsmonitor: do not forget to release the token in `discard_index()` (diff)
downloadtgif-1dd4e7452295618b20703deffc4241bf7dd4be4f.tar.xz
Merge branch 'js/fsmonitor-unpack-fix'
The data structure used by fsmonitor interface was not properly duplicated during an in-core merge, leading to use-after-free etc. * js/fsmonitor-unpack-fix: fsmonitor: do not forget to release the token in `discard_index()` fsmonitor: fix memory corruption in some corner cases
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index eb8fcda31b..9298fe1d9b 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1612,8 +1612,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
o->merge_size = len;
mark_all_ce_unused(o->src_index);
- if (o->src_index->fsmonitor_last_update)
- o->result.fsmonitor_last_update = o->src_index->fsmonitor_last_update;
+ o->result.fsmonitor_last_update =
+ xstrdup_or_null(o->src_index->fsmonitor_last_update);
/*
* Sparse checkout loop #1: set NEW_SKIP_WORKTREE on existing entries