Commit 921be706a9bba2b7321c994a0410bff1baa46240

Stefan Sperling 2019-06-28T12:23:58

fix segfault in error path of 'tog diff'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/tog/tog.c b/tog/tog.c
index 2b8c94f..fc0bb75 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -2853,7 +2853,8 @@ cmd_diff(int argc, char *argv[])
 	error = view_loop(view);
 done:
 	free(repo_path);
-	got_repo_close(repo);
+	if (repo)
+		got_repo_close(repo);
 	got_ref_list_free(&refs);
 	return error;
 }