Commit Diff


commit - c5996fffdf906ace91b9ec3e51dcb23eb806e187
commit + 18da997892569f062e33d862f756b1fe9ce070f2
blob - f7bb586fd54ca2d00f227ba62eda2df9d9d43f8b
blob + 74afd10ed4ab87698c8c2738d9afe6326cfaa6fb
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
@@ -575,16 +575,22 @@ gw_commits(struct gw_trans *gw_trans)
 
 	error = gw_get_header(gw_trans, header,
 	    gw_trans->gw_conf->got_max_commits_display);
+	if (error)
+		goto done;
 
 	kerr = khttp_puts(gw_trans->gw_req, commits_wrapper);
-	if (kerr != KCGI_OK)
-		return gw_kcgi_error(kerr);
+	if (kerr != KCGI_OK) {
+		error = gw_kcgi_error(kerr);
+		goto done;
+	}
 	TAILQ_FOREACH(n_header, &gw_trans->gw_headers, entry) {
 		if ((asprintf(&commits_navs_html, commits_navs,
 		    gw_trans->repo_name, n_header->commit_id,
 		    gw_trans->repo_name, n_header->commit_id,
-		    gw_trans->repo_name, n_header->commit_id)) == -1)
-			return got_error_from_errno("asprintf");
+		    gw_trans->repo_name, n_header->commit_id)) == -1) {
+			error = got_error_from_errno("asprintf");
+			goto done;
+		}
 
 		if ((asprintf(&commits_html, commits_line,
 	    	    gw_gen_commit_header(n_header->commit_id,
@@ -593,16 +599,20 @@ gw_commits(struct gw_trans *gw_trans)
 	    	    gw_gen_committer_header(n_header->committer),
 		    gw_gen_age_header(gw_get_time_str(n_header->committer_time,
 		        TM_LONG)), gw_html_escape(n_header->commit_msg),
-		    commits_navs_html)) == -1)
-			return got_error_from_errno("asprintf");
+		    commits_navs_html)) == -1) {
+			error = got_error_from_errno("asprintf");
+			goto done;
+		}
 		kerr = khttp_puts(gw_trans->gw_req, commits_html);
-		if (kerr != KCGI_OK)
-			return gw_kcgi_error(kerr);
+		if (kerr != KCGI_OK) {
+			error = gw_kcgi_error(kerr);
+			goto done;
+		}
 	}
 	kerr = khttp_puts(gw_trans->gw_req, div_end);
 	if (kerr != KCGI_OK)
 		error = gw_kcgi_error(kerr);
-
+done:
 	got_ref_list_free(&header->refs);
 	gw_free_headers(header);
 	TAILQ_FOREACH(n_header, &gw_trans->gw_headers, entry)