diff: use hashmap_entry_init on moved_entry.ent

Otherwise, the hashmap_entry.next field appears to remain uninitialized, which can lead to problems when add_lines_to_move_detection calls hashmap_add. I found this through manual inspection when converting hashmap_add callers to take "struct hashmap_entry *". Signed-off-by: Eric Wong <e@80x24.org> Reviewed-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Eric Wong committed Oct 6, 2019 at 23:30 UTC e010a41216efd85eacc4c0711ea405de4fb20526
1 file changed +2 -1
diff.c
+2 -1
@@ -964,8 +964,9 @@ static struct moved_entry *prepare_entry(struct diff_options *o,
964 struct moved_entry *ret = xmalloc(sizeof(*ret));
965 struct emitted_diff_symbol *l = &o->emitted_symbols->buf[line_no];
966 unsigned flags = o->color_moved_ws_handling & XDF_WHITESPACE_FLAGS;
967 + unsigned int hash = xdiff_hash_string(l->line, l->len, flags);
968
968 - ret->ent.hash = xdiff_hash_string(l->line, l->len, flags);
969 + hashmap_entry_init(&ret->ent, hash);
970 ret->es = l;
971 ret->next_line = NULL;
972