diff --color-moved: fix a memory leak
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>
Phillip Wood committed
Oct 4, 2018 at 11:07 UTC
47cb16a26447b32f5440c3a109ad5f16a5f735bd
1 file changed
+2
-2
diff.c
+2
-2
@@ -5852,8 +5852,8 @@ static void diff_flush_patch_all_file_pairs(struct diff_options *o)
5852
if (o->color_moved == COLOR_MOVED_ZEBRA_DIM)
5853
dim_moved_lines(o);
5854
5855
- hashmap_free(&add_lines, 0);
5856
- hashmap_free(&del_lines, 0);
5855
+ hashmap_free(&add_lines, 1);
5856
+ hashmap_free(&del_lines, 1);
5857
}
5858
5859
for (i = 0; i < esm.nr; i++)