Commit a55555f2c7fbcf2e430c5a8a866e53221dd8d279

Stefan Sperling 2019-03-29T06:44:52

ensure that ref list is always initialized in tog's cmd_log()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/tog/tog.c b/tog/tog.c
index 1a7431f..998a4ef 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -1829,6 +1829,8 @@ cmd_log(int argc, char *argv[])
 	int ch;
 	struct tog_view *view;
 
+	SIMPLEQ_INIT(&refs);
+
 #ifndef PROFILE
 	if (pledge("stdio rpath wpath cpath flock proc tty exec sendfd unveil",
 	    NULL) == -1)
@@ -1912,7 +1914,6 @@ cmd_log(int argc, char *argv[])
 	if (error != NULL)
 		goto done;
 
-	SIMPLEQ_INIT(&refs);
 	error = got_ref_list(&refs, repo);
 	if (error)
 		goto done;