]> git.ipfire.org Git - thirdparty/git.git/commitdiff
diff.c: free "buf" in diff_words_flush()
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 4 Mar 2022 18:32:06 +0000 (19:32 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 4 Mar 2022 21:24:18 +0000 (13:24 -0800)
Amend the freeing logic added in e6e045f8031 (diff.c: buffer all
output if asked to, 2017-06-29) to free the containing "buf" in
addition to its members.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c

diff --git a/diff.c b/diff.c
index c4ccb6b1a343c5d418773b85c49c88284f029704..c5bc9bc5128365d5168881a55c79b39d88ca242b 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -2150,6 +2150,7 @@ static void diff_words_flush(struct emit_callback *ecbdata)
 
                for (i = 0; i < wol->nr; i++)
                        free((void *)wol->buf[i].line);
+               free(wol->buf);
 
                wol->nr = 0;
        }