aboutsummaryrefslogtreecommitdiffstats
path: root/wt-status.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-05-07 12:47:41 +0900
committerJunio C Hamano <gitster@pobox.com>2021-05-07 12:47:41 +0900
commit936e58851af0324d408c9e1a70cddd288d892a45 (patch)
tree6c0eaca13d0c6f4d7343d773a994441b042d1729 /wt-status.c
parent8585d6c04aa903526b4b3554e90d6381ec62390a (diff)
parent37be11994f95d0519f3a7274df5254e56f56a7fe (diff)
downloadgit-936e58851af0324d408c9e1a70cddd288d892a45.tar.gz
Merge branch 'ah/plugleaks'
Plug various leans reported by LSAN. * ah/plugleaks: builtin/rm: avoid leaking pathspec and seen builtin/rebase: release git_format_patch_opt too builtin/for-each-ref: free filter and UNLEAK sorting. mailinfo: also free strbuf lists when clearing mailinfo builtin/checkout: clear pending objects after diffing builtin/check-ignore: clear_pathspec before returning builtin/bugreport: don't leak prefixed filename branch: FREE_AND_NULL instead of NULL'ing real_ref bloom: clear each bloom_key after use ls-files: free max_prefix when done wt-status: fix multiple small leaks revision: free remainder of old commit list in limit_list
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/wt-status.c b/wt-status.c
index 1aed68c43c..34886655db 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -616,6 +616,7 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
rev.diffopt.rename_score = s->rename_score >= 0 ? s->rename_score : rev.diffopt.rename_score;
copy_pathspec(&rev.prune_data, &s->pathspec);
run_diff_files(&rev, 0);
+ clear_pathspec(&rev.prune_data);
}
static void wt_status_collect_changes_index(struct wt_status *s)
@@ -652,6 +653,8 @@ static void wt_status_collect_changes_index(struct wt_status *s)
rev.diffopt.rename_score = s->rename_score >= 0 ? s->rename_score : rev.diffopt.rename_score;
copy_pathspec(&rev.prune_data, &s->pathspec);
run_diff_index(&rev, 1);
+ object_array_clear(&rev.pending);
+ clear_pathspec(&rev.prune_data);
}
static void wt_status_collect_changes_initial(struct wt_status *s)
@@ -2480,6 +2483,7 @@ int has_uncommitted_changes(struct repository *r,
diff_setup_done(&rev_info.diffopt);
result = run_diff_index(&rev_info, 1);
+ object_array_clear(&rev_info.pending);
return diff_result_code(&rev_info.diffopt, result);
}