Commit Diff


commit - 390d412cade5c0345973c41950ca735d2cf96342
commit + a0f36e0337978dfc927b0bc7c5fae4ca03a8bb00
blob - de158a382f5ab05687a8bf792a1304d479a13be2
blob + 218a347a2018ecd36b16e09b88993d616dc7fec1
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
@@ -1353,6 +1353,8 @@ gw_get_repo_age(struct gw_trans *gw_trans, char *dir, 
 	time_t committer_time = 0, cmp_time = 0;
 	const char *refname;
 	char *repo_age = NULL;
+
+	SIMPLEQ_INIT(&refs);
 
 	if (repo_ref == NULL)
 		return NULL;
@@ -1360,7 +1362,6 @@ gw_get_repo_age(struct gw_trans *gw_trans, char *dir, 
 	if (strncmp(repo_ref, "refs/heads/", 11) == 0)
 		is_head = 1;
 
-	SIMPLEQ_INIT(&refs);
 	if (gw_trans->gw_conf->got_show_repo_age == false) {
 		if ((asprintf(&repo_age, "")) == -1)
 			return NULL;
@@ -1621,10 +1622,11 @@ gw_get_repo_tags(struct gw_trans *gw_trans, int limit,
 	struct buf *diffbuf = NULL;
 	size_t newsize;
 
+	SIMPLEQ_INIT(&refs);
+
 	error = buf_alloc(&diffbuf, 0);
 	if (error)
 		return NULL;
-	SIMPLEQ_INIT(&refs);
 
 	error = got_repo_open(&repo, gw_trans->repo_path, NULL);
 	if (error)
@@ -2477,6 +2479,8 @@ gw_get_repo_heads(struct gw_trans *gw_trans)
 	char *heads, *head_row = NULL, *head_navs_disp = NULL, *age = NULL;
 	struct buf *diffbuf = NULL;
 	size_t newsize;
+
+	SIMPLEQ_INIT(&refs);
 
 	error = buf_alloc(&diffbuf, 0);
 	if (error)
@@ -2486,7 +2490,6 @@ gw_get_repo_heads(struct gw_trans *gw_trans)
 	if (error)
 		goto done;
 
-	SIMPLEQ_INIT(&refs);
 	error = got_ref_list(&refs, repo, "refs/heads", got_ref_cmp_by_name,
 	    NULL);
 	if (error)