aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-10-25 16:06:59 -0700
committerJunio C Hamano <gitster@pobox.com>2021-10-25 16:06:59 -0700
commit54c4f8ce52f20ea1be99c780ce19867964f430b7 (patch)
tree7e3f9f4a7c804821f32750f7d7d5cd28bf71856a /builtin
parent5a4f8381b68b39e1a39e78039ddb2c415927cb12 (diff)
parent465028e0e25518bfff8b83057775cb6b2df2aade (diff)
downloadgit-54c4f8ce52f20ea1be99c780ce19867964f430b7.tar.gz
Merge branch 'ab/mark-leak-free-tests-more'
Bunch of tests are marked as "passing leak check". * ab/mark-leak-free-tests-more: merge: add missing strbuf_release() ls-files: add missing string_list_clear() ls-files: fix a trivial dir_clear() leak tests: fix test-oid-array leak, test in SANITIZE=leak tests: fix a memory leak in test-oidtree.c tests: fix a memory leak in test-parse-options.c tests: fix a memory leak in test-prio-queue.c
Diffstat (limited to 'builtin')
-rw-r--r--builtin/ls-files.c14
-rw-r--r--builtin/merge.c2
2 files changed, 8 insertions, 8 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index a2000ed6bf..031fef1bca 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -672,6 +672,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
N_("suppress duplicate entries")),
OPT_END()
};
+ int ret = 0;
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(ls_files_usage, builtin_ls_files_options);
@@ -775,16 +776,13 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
if (show_resolve_undo)
show_ru_info(the_repository->index);
- if (ps_matched) {
- int bad;
- bad = report_path_error(ps_matched, &pathspec);
- if (bad)
- fprintf(stderr, "Did you forget to 'git add'?\n");
-
- return bad ? 1 : 0;
+ if (ps_matched && report_path_error(ps_matched, &pathspec)) {
+ fprintf(stderr, "Did you forget to 'git add'?\n");
+ ret = 1;
}
+ string_list_clear(&exclude_list, 0);
dir_clear(&dir);
free(max_prefix);
- return 0;
+ return ret;
}
diff --git a/builtin/merge.c b/builtin/merge.c
index cc4a910c69..ea3112e0c0 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1578,6 +1578,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
finish(head_commit, remoteheads, &commit->object.oid, msg.buf);
remove_merge_branch_state(the_repository);
+ strbuf_release(&msg);
goto done;
} else if (!remoteheads->next && common->next)
;
@@ -1748,6 +1749,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
ret = suggest_conflicts();
done:
+ strbuf_release(&buf);
free(branch_to_free);
return ret;
}