Skip to content

Commit 47cb16a

Browse files
phillipwoodgitster
authored andcommitted
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 <[email protected]> Reviewed-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9c1a6c2 commit 47cb16a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

diff.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5852,8 +5852,8 @@ static void diff_flush_patch_all_file_pairs(struct diff_options *o)
58525852
if (o->color_moved == COLOR_MOVED_ZEBRA_DIM)
58535853
dim_moved_lines(o);
58545854

5855-
hashmap_free(&add_lines, 0);
5856-
hashmap_free(&del_lines, 0);
5855+
hashmap_free(&add_lines, 1);
5856+
hashmap_free(&del_lines, 1);
58575857
}
58585858

58595859
for (i = 0; i < esm.nr; i++)

0 commit comments

Comments
 (0)