aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/scalar/scalar.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-07-18 13:31:56 -0700
committerJunio C Hamano <gitster@pobox.com>2022-07-18 13:31:57 -0700
commit7f8d098b1b1ca1e5b91b17d05b51bc5b7a7ad6bf (patch)
tree5f4b1b70e19b990092cecc676422042ad12e642a /contrib/scalar/scalar.c
parentMerge branch 'gc/submodule-use-super-prefix' (diff)
parentcocci: generalize "unused" rule to cover more than "strbuf" (diff)
downloadgit-7f8d098b1b1ca1e5b91b17d05b51bc5b7a7ad6bf.tar.gz
git-7f8d098b1b1ca1e5b91b17d05b51bc5b7a7ad6bf.zip
Merge branch 'ab/cocci-unused'
Add Coccinelle rules to detect the pattern of initializing and then finalizing a structure without using it in between at all, which happens after code restructuring and the compilers fail to recognize as an unused variable. * ab/cocci-unused: cocci: generalize "unused" rule to cover more than "strbuf" cocci: add and apply a rule to find "unused" strbufs cocci: have "coccicheck{,-pending}" depend on "coccicheck-test" cocci: add a "coccicheck-test" target and test *.cocci rules Makefile & .gitignore: ignore & clean "git.res", not "*.res" Makefile: remove mandatory "spatch" arguments from SPATCH_FLAGS
Diffstat (limited to 'contrib/scalar/scalar.c')
-rw-r--r--contrib/scalar/scalar.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/contrib/scalar/scalar.c b/contrib/scalar/scalar.c
index 28176914e5..97e71fe19c 100644
--- a/contrib/scalar/scalar.c
+++ b/contrib/scalar/scalar.c
@@ -687,7 +687,7 @@ static int cmd_diagnose(int argc, const char **argv)
int stdout_fd = -1, archiver_fd = -1;
time_t now = time(NULL);
struct tm tm;
- struct strbuf path = STRBUF_INIT, buf = STRBUF_INIT;
+ struct strbuf buf = STRBUF_INIT;
int res = 0;
argc = parse_options(argc, argv, NULL, options,
@@ -779,7 +779,6 @@ diagnose_cleanup:
free(argv_copy);
strvec_clear(&archiver_args);
strbuf_release(&zip_path);
- strbuf_release(&path);
strbuf_release(&buf);
return res;