Commit 2dcb56a8795aa01fa28e97093758b8f8fb976799

Stefan Sperling 2020-01-28T13:31:18

remove unnecessary NULL checks; if header is NULL we don't get here

diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index 218a347..8cc8ff9 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -408,8 +408,7 @@ gw_diff(struct gw_trans *gw_trans)
 	if (kerr != KCGI_OK)
 		error = gw_kcgi_error(kerr);
 done:
-	if (header)
-		got_ref_list_free(&header->refs);
+	got_ref_list_free(&header->refs);
 	gw_free_headers(header);
 	free(diff_html_disp);
 	free(diff_html);
@@ -600,8 +599,7 @@ gw_commits(struct gw_trans *gw_trans)
 	if (kerr != KCGI_OK)
 		error = gw_kcgi_error(kerr);
 
-	if (header)
-		got_ref_list_free(&header->refs);
+	got_ref_list_free(&header->refs);
 	gw_free_headers(header);
 	TAILQ_FOREACH(n_header, &gw_trans->gw_headers, entry)
 		gw_free_headers(n_header);
@@ -664,8 +662,7 @@ gw_briefs(struct gw_trans *gw_trans)
 	if (kerr != KCGI_OK)
 		error = gw_kcgi_error(kerr);
 
-	if (header)
-		got_ref_list_free(&header->refs);
+	got_ref_list_free(&header->refs);
 	gw_free_headers(header);
 	TAILQ_FOREACH(n_header, &gw_trans->gw_headers, entry)
 		gw_free_headers(n_header);
@@ -823,8 +820,7 @@ gw_tree(struct gw_trans *gw_trans)
 	kerr = khttp_puts(gw_trans->gw_req, tree);
 	if (kerr != KCGI_OK)
 		error = gw_kcgi_error(kerr);
-	if (header)
-		got_ref_list_free(&header->refs);
+	got_ref_list_free(&header->refs);
 	gw_free_headers(header);
 	free(tree_html_disp);
 	free(tree_html);