From c5a1c5813d2848faa19f28b225f332b22319c776 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 15 Aug 2024 21:00:50 +0200 Subject: Fix bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- git-rediff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-rediff.c b/git-rediff.c index 009565c..c34e854 100644 --- a/git-rediff.c +++ b/git-rediff.c @@ -263,7 +263,8 @@ diff_subhunks(const struct subhunk *f1, const struct subhunk *f2) if (waitpid(piddiff, &status, 0) != piddiff) eprintf("waitpid 0:"); if (status == 0) { - ret = erealloc(ret, f1->text.nlines + 1U); + ret_off = f1->text.nlines; + ret = erealloc(ret, ret_off + 1U); memset(ret, ' ', f1->text.nlines); } else if (WIFEXITED(status) && WEXITSTATUS(status) == 1) { ret = erealloc(ret, ret_off + 1U); -- cgit v1.2.3-70-g09d2