Download raw body.
gotwebd: fix null-deref and ENOMEM question
I'm still seeing gotwebd increasing its memory usage over time so I'm still searching for leaks. I've seen that we miss two free on the string returned by gotweb_get_time_str, and while here I'm also dropping a redundant ternary operator (age cannot be NULL if gotweb_get_time_str returned successfully.) this still doesn't explain why gotwebd reached 600M of RES in hours, so there's probably more. ok? diff /home/op/w/got commit - f0680473a7db1e5941bffdc2ab5f80ddec209122 path + /home/op/w/got blob - 363270dc22f396c6ba871d5448b712f226c3a791 file + gotwebd/gotweb.c --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -1172,7 +1172,7 @@ gotweb_render_blame(struct request *c) "</div>\n" /* #blame_header_wrapper */ "<div class='dotted_line'></div>\n" "<div id='blame'>\n", - age ? age : "", + age, msg); if (r == -1) goto done; @@ -1184,6 +1184,7 @@ gotweb_render_blame(struct request *c) fcgi_printf(c, "</div>\n" /* #blame */ "</div>\n"); /* #blame_content */ done: + free(age); free(msg); return error; } @@ -1244,7 +1245,7 @@ gotweb_render_briefs(struct request *c) "<div class='briefs_log'>" "<a href='?index_page=%s&path=%s&action=diff&commit=%s" "&headref=%s'>%s</a>", - age ? age : "", + age, author, index_page_str, repo_dir->name, rc->commit_id, qs->headref, msg); @@ -1353,7 +1354,7 @@ gotweb_render_commits(struct request *c) "<div class='commit'>\n%s</div>\n", rc->commit_id, author, - age ? age : "", + age, msg); if (r == -1) goto done; @@ -1527,7 +1528,7 @@ gotweb_render_tree(struct request *c) "<div class='dotted_line'></div>\n" "<div id='tree'>\n", rc->tree_id, - age ? age : "", + age, msg); if (r == -1) goto done; @@ -1539,6 +1540,7 @@ gotweb_render_tree(struct request *c) fcgi_printf(c, "</div>\n"); /* #tree */ fcgi_printf(c, "</div>\n"); /* #tree_content */ done: + free(age); free(msg); return error; } @@ -1594,7 +1596,7 @@ gotweb_render_diff(struct request *c) rc->commit_id, rc->tree_id, author, - age ? age : "", + age, msg); if (r == -1) goto done; @@ -1740,7 +1742,7 @@ gotweb_render_tag(struct request *c) rt->commit_id, tagname, author, - age ? age : "", + age, msg, rt->tag_commit); @@ -1833,7 +1835,7 @@ gotweb_render_tags(struct request *c) "</div>\n" /* .navs */ "</div>\n" /* .navs_wrapper */ "<div class='dotted_line'></div>\n", - age ? age : "", + age, tagname, index_page_str, repo_dir->name, rt->commit_id, msg ? msg : "",
gotwebd: fix null-deref and ENOMEM question