Skip to content

Commit

Permalink
Fix segmentation fault
Browse files Browse the repository at this point in the history
As reported by Maxim Zhukov, the commit 9ca7710 ("Fix memory leak in
main view (#931)", 01-06-2019) causes a SIGSEGV when holding the key
'Stage/Unstage current line' in stage view.

Add a check to avoid null pointer dereference.

Fixes #971
  • Loading branch information
koutcher committed Nov 25, 2019
1 parent 89c8fa2 commit 6202c60
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/graph-v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ done_graph(struct graph *graph_ref)
{
struct graph_v2 *graph = graph_ref->private;

htab_delete(graph->colors.id_map);
if (graph->colors.id_map)
htab_delete(graph->colors.id_map);

free(graph);

Expand Down

0 comments on commit 6202c60

Please sign in to comment.