log: fix memory leak if --graph is passed multiple times
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
2b9c120970
commit
dccf6c16f1
12
graph.c
12
graph.c
@ -401,6 +401,18 @@ struct git_graph *graph_init(struct rev_info *opt)
|
||||
return graph;
|
||||
}
|
||||
|
||||
void graph_clear(struct git_graph *graph)
|
||||
{
|
||||
if (!graph)
|
||||
return;
|
||||
|
||||
free(graph->columns);
|
||||
free(graph->new_columns);
|
||||
free(graph->mapping);
|
||||
free(graph->old_mapping);
|
||||
free(graph);
|
||||
}
|
||||
|
||||
static void graph_update_state(struct git_graph *graph, enum graph_state s)
|
||||
{
|
||||
graph->prev_state = graph->state;
|
||||
|
Reference in New Issue
Block a user