Commit Diff


commit - 0e00e8f4e2c00df4d65d269af5e978d35f46fc02
commit + 42281175e016d971dfffd64f2e8f1330fde1fc09
blob - 624d8496501e2f3bc921748a3c9b63590084c191
blob + be2a106497e1c7a99f0c20632b6d519cebccf898
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
@@ -822,7 +822,7 @@ gw_tree(struct gw_trans *gw_trans)
 
 	error = gw_get_header(gw_trans, header, 1);
 	if (error)
-		return error;
+		goto done;
 
 	tree_html = gw_get_repo_tree(gw_trans);
 
@@ -837,11 +837,15 @@ gw_tree(struct gw_trans *gw_trans)
 	if ((asprintf(&tree_html_disp, tree_header,
 	    gw_gen_age_header(gw_get_time_str(header->committer_time, TM_LONG)),
 	    gw_gen_commit_msg_header(gw_html_escape(header->commit_msg)),
-	    tree_html)) == -1)
-		return got_error_from_errno("asprintf");
+	    tree_html)) == -1) {
+		error = got_error_from_errno("asprintf");
+		goto done;
+	}
 
-	if ((asprintf(&tree, tree_wrapper, tree_html_disp)) == -1)
-		return got_error_from_errno("asprintf");
+	if (asprintf(&tree, tree_wrapper, tree_html_disp) == -1) {
+		error = got_error_from_errno("asprintf");
+		goto done;
+	}
 
 	kerr = khttp_puts(gw_trans->gw_req, tree);
 	if (kerr != KCGI_OK)