[4/5] diff --color-moved-ws: fix another memory leak
diff mbox series

Message ID 20181002175514.31495-4-phillip.wood@talktalk.net
State New
Headers show
Series
  • [1/5] diff --color-moved-ws: fix double free crash
Related show

Commit Message

Phillip Wood Oct. 2, 2018, 5:55 p.m. UTC
From: Phillip Wood <phillip.wood@dunelm.org.uk>

This is obvious in retrospect, it was found with asan.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
 diff.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stefan Beller Oct. 2, 2018, 7:08 p.m. UTC | #1
On Tue, Oct 2, 2018 at 10:55 AM Phillip Wood <phillip.wood@talktalk.net> wrote:
>
> From: Phillip Wood <phillip.wood@dunelm.org.uk>
>
> This is obvious in retrospect, it was found with asan.

Indeed. :/

Thanks,
Stefan

Patch
diff mbox series

diff --git a/diff.c b/diff.c
index efadd05c90..4464feacf8 100644
--- a/diff.c
+++ b/diff.c
@@ -971,6 +971,8 @@  static void pmb_advance_or_null_multi_match(struct diff_options *o,
 			moved_block_clear(&pmb[i]);
 		}
 	}
+
+	free(got_match);
 }
 
 static int shrink_potential_moved_blocks(struct moved_block *pmb,