ensure that the result of gw_init_header() is always freed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index 5a09e34..e17fd09 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -318,18 +318,20 @@ gw_blame(struct gw_trans *gw_trans)
error = gw_apply_unveil(gw_trans->gw_dir->path, NULL);
if (error)
- return error;
+ goto done;
error = gw_get_header(gw_trans, header, 1);
if (error)
- return error;
+ goto done;
blame_html = gw_get_file_blame(gw_trans);
if (blame_html == NULL) {
blame_html = strdup("");
- if (blame_html == NULL)
- return got_error_from_errno("strdup");
+ if (blame_html == NULL) {
+ error = got_error_from_errno("strdup");
+ goto done;
+ }
}
if ((asprintf(&blame_html_disp, blame_header,
@@ -566,12 +568,12 @@ gw_commits(struct gw_trans *gw_trans)
if (pledge("stdio rpath proc exec sendfd unveil",
NULL) == -1) {
error = got_error_from_errno("pledge");
- return error;
+ goto done;
}
error = gw_apply_unveil(gw_trans->gw_dir->path, NULL);
if (error)
- return error;
+ goto done;
error = gw_get_header(gw_trans, header,
gw_trans->gw_conf->got_max_commits_display);
@@ -634,12 +636,12 @@ gw_briefs(struct gw_trans *gw_trans)
if (pledge("stdio rpath proc exec sendfd unveil",
NULL) == -1) {
error = got_error_from_errno("pledge");
- return error;
+ goto done;
}
error = gw_apply_unveil(gw_trans->gw_dir->path, NULL);
if (error)
- return error;
+ goto done;
if (gw_trans->action == GW_SUMMARY)
error = gw_get_header(gw_trans, header, D_MAXSLCOMMDISP);
@@ -818,7 +820,7 @@ gw_tree(struct gw_trans *gw_trans)
error = gw_apply_unveil(gw_trans->gw_dir->path, NULL);
if (error)
- return error;
+ goto done;
error = gw_get_header(gw_trans, header, 1);
if (error)
@@ -875,7 +877,7 @@ gw_tag(struct gw_trans *gw_trans)
error = gw_apply_unveil(gw_trans->gw_dir->path, NULL);
if (error)
- return error;
+ goto done;
error = gw_get_header(gw_trans, header, 1);
if (error)