diff mbox series

[v2,03/14] diff.c: free "buf" in diff_words_flush()

Message ID patch-v2-03.14-90517a05582-20220304T182902Z-avarab@gmail.com (mailing list archive)
State Accepted
Commit a18d66cefb9e5ee4fd49be1d60e90523cd89ca0f
Headers show
Series tree-wide: small fixes for memory leaks | expand

Commit Message

Ævar Arnfjörð Bjarmason March 4, 2022, 6:32 p.m. UTC
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>
---
 diff.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/diff.c b/diff.c
index c4ccb6b1a34..c5bc9bc5128 100644
--- 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;
 	}