diff --color-moved: fix a memory leak
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Thu, 4 Oct 2018 10:07:45 +0000 (11:07 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Oct 2018 05:48:21 +0000 (22:48 -0700)
Free the hashmap items as well as the hashmap itself. This was found
with asan.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
diff --git a/diff.c b/diff.c
index e0ebddfac9f024945844a77c971ab9a6596e3fb5..c29b1cce145bfd40f9b7511b9a8966f5072e3226 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -5852,8 +5852,8 @@ static void diff_flush_patch_all_file_pairs(struct diff_options *o)
                        if (o->color_moved == COLOR_MOVED_ZEBRA_DIM)
                                dim_moved_lines(o);
 
-                       hashmap_free(&add_lines, 0);
-                       hashmap_free(&del_lines, 0);
+                       hashmap_free(&add_lines, 1);
+                       hashmap_free(&del_lines, 1);
                }
 
                for (i = 0; i < esm.nr; i++)