summaryrefslogtreecommitdiff
path: root/sparse-index.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-05-17 12:22:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-05-17 21:29:17 (GMT)
commit4279cb1c6e4e5b60b099833d8e3debba4ac35eba (patch)
treec1582acf1b70d54161133eaecdcfc06614325c25 /sparse-index.c
parent4589bca829a2ace58bc98876cccd7dbd2e89f732 (diff)
downloadgit-4279cb1c6e4e5b60b099833d8e3debba4ac35eba.zip
git-4279cb1c6e4e5b60b099833d8e3debba4ac35eba.tar.gz
git-4279cb1c6e4e5b60b099833d8e3debba4ac35eba.tar.bz2
sparse-index: fix uninitialized jump
While testing the sparse-index, I verified a test with --valgrind and it complained about an uninitialized value being used in a jump in the path_matches_pattern_list() method. The line was this one: if (*dtype == DT_UNKNOWN) In the call stack, the culprit was the initialization of the dtype variable in convert_to_sparse_rec(). Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sparse-index.c')
-rw-r--r--sparse-index.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sparse-index.c b/sparse-index.c
index 6f21397..ca839e4 100644
--- a/sparse-index.c
+++ b/sparse-index.c
@@ -34,7 +34,7 @@ static int convert_to_sparse_rec(struct index_state *istate,
int i, can_convert = 1;
int start_converted = num_converted;
enum pattern_match_result match;
- int dtype;
+ int dtype = DT_UNKNOWN;
struct strbuf child_path = STRBUF_INIT;
struct pattern_list *pl = istate->sparse_checkout_patterns;