Commit 7a9bfbffc3cd8f01a9d19951b140a4e662b7d4b1

Stefan Sperling 2020-01-29T13:59:25

call khtml_close() in gw_display_index() even when an error occurred

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index 8659eb5..8e8c6ac 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -1195,11 +1195,12 @@ gw_display_index(struct gw_trans *gw_trans, const struct got_error *err)
 	else
 		kerr = khttp_template(gw_trans->gw_req, gw_trans->gw_tmpl,
 		    gw_query_funcs[gw_trans->action].template);
-	if (kerr != KCGI_OK)
+	if (kerr != KCGI_OK) {
+		khtml_close(gw_trans->gw_html_req);
 		return gw_kcgi_error(kerr);
+	}
 
-	kerr = khtml_close(gw_trans->gw_html_req);
-	return gw_kcgi_error(kerr);
+	return gw_kcgi_error(khtml_close(gw_trans->gw_html_req));
 }
 
 static int