aboutsummaryrefslogtreecommitdiffstats
path: root/combine-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-11-07 13:23:02 +0900
committerJunio C Hamano <gitster@pobox.com>2024-11-07 13:25:01 +0900
commit2664f2a0cb18369253acadfa3cb43b1cbf0ae067 (patch)
tree926ef066f1d90ce88791bf57dbbaaeb2ab56d321 /combine-diff.c
parent8f8d6eee531b3fa1a8ef14f169b0cb5035f7a772 (diff)
parentc810549be1dd31e1a0a1de5060a519a461533564 (diff)
downloadgit-2664f2a0cb18369253acadfa3cb43b1cbf0ae067.tar.gz
Merge branch 'ps/leakfixes-part-9' into ps/leakfixes-part-10
* ps/leakfixes-part-9: (22 commits) list-objects-filter-options: work around reported leak on error builtin/merge: release output buffer after performing merge dir: fix leak when parsing "status.showUntrackedFiles" t/helper: fix leaking buffer in "dump-untracked-cache" t/helper: stop re-initialization of `the_repository` sparse-index: correctly free EWAH contents dir: release untracked cache data combine-diff: fix leaking lost lines builtin/tag: fix leaking key ID on failure to sign transport-helper: fix leaking import/export marks builtin/commit: fix leaking cleanup config trailer: fix leaking strbufs when formatting trailers trailer: fix leaking trailer values builtin/commit: fix leaking change data contents upload-pack: fix leaking URI protocols pretty: clear signature check diff-lib: fix leaking diffopts in `do_diff_cache()` revision: fix leaking bloom filters builtin/grep: fix leak with `--max-count=0` grep: fix leak in `grep_splice_or()` ...
Diffstat (limited to 'combine-diff.c')
-rw-r--r--combine-diff.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/combine-diff.c b/combine-diff.c
index f6b624dc28..33d0ed7097 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -1185,7 +1185,8 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
result_file.ptr = result;
result_file.size = result_size;
- /* Even p_lno[cnt+1] is valid -- that is for the end line number
+ /*
+ * Even p_lno[cnt+1] is valid -- that is for the end line number
* for deletion hunk at the end.
*/
CALLOC_ARRAY(sline[0].p_lno, st_mult(st_add(cnt, 2), num_parent));
@@ -1220,7 +1221,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
}
free(result);
- for (lno = 0; lno < cnt; lno++) {
+ for (lno = 0; lno < cnt + 2; lno++) {
if (sline[lno].lost) {
struct lline *ll = sline[lno].lost;
while (ll) {