sparse-index: fix uninitialized jump
PATCH 1/1 sparse-index: fix uninitialized jump
From: Derrick Stolee <[email protected]>
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().
---
Sparse-index: fix uninitialized variable
I noticed this by accident while using --valgrind for a different reason. Seems like an easy fix.
Thanks, -Stolee
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-953%2Fderrickstolee%2Fsparse-index%2Funinitialized-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-953/derrickstolee/sparse-index/uninitialized-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/953
sparse-index.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sparse-index.c +1 -1
@@ -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;
base-commit: bf949ade81106fbda068c1fdb2c6fd1cb1babe7e
Signature · 1 line
gitgitgadget
Quoted 6 lines · Derrick Stolee via GitGitGadget
From: Derrick Stolee <[email protected]>
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:
Quoted 7 lines
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 <[email protected]>---
Looks good.
Quoted 22 lines
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-953%2Fderrickstolee%2Fsparse-index%2Funinitialized-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-953/derrickstolee/sparse-index/uninitialized-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/953sparse-index.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)sparse-index.c +1
-1@@ -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;base-commit:
bf949ade81106fbda068c1fdb2c6fd1cb1babe7e