ui-shared: fix resource leak: free allocation from cgit_fileurl

Coverity-id: 13918
Signed-off-by: Christian Hesse <mail@eworm.de>
このコミットが含まれているのは:
Christian Hesse 2015-10-09 13:15:46 +02:00 committed by Jason A. Donenfeld
コミット 37fce9916a

ファイルの表示

@ -746,16 +746,19 @@ void cgit_print_docstart(void)
html("'/>\n"); html("'/>\n");
} }
if (host && ctx.repo && ctx.qry.head) { if (host && ctx.repo && ctx.qry.head) {
char *fileurl;
struct strbuf sb = STRBUF_INIT; struct strbuf sb = STRBUF_INIT;
strbuf_addf(&sb, "h=%s", ctx.qry.head); strbuf_addf(&sb, "h=%s", ctx.qry.head);
html("<link rel='alternate' title='Atom feed' href='"); html("<link rel='alternate' title='Atom feed' href='");
html(cgit_httpscheme()); html(cgit_httpscheme());
html_attr(cgit_hosturl()); html_attr(cgit_hosturl());
html_attr(cgit_fileurl(ctx.repo->url, "atom", ctx.qry.vpath, fileurl = cgit_fileurl(ctx.repo->url, "atom", ctx.qry.vpath,
sb.buf)); sb.buf);
html_attr(fileurl);
html("' type='application/atom+xml'/>\n"); html("' type='application/atom+xml'/>\n");
strbuf_release(&sb); strbuf_release(&sb);
free(fileurl);
} }
if (ctx.repo) if (ctx.repo)
cgit_add_clone_urls(print_rel_vcs_link); cgit_add_clone_urls(print_rel_vcs_link);
@ -997,9 +1000,12 @@ void cgit_print_pageheader(void)
ctx.qry.head, ctx.qry.vpath); ctx.qry.head, ctx.qry.vpath);
html("</td><td class='form'>"); html("</td><td class='form'>");
html("<form class='right' method='get' action='"); html("<form class='right' method='get' action='");
if (ctx.cfg.virtual_root) if (ctx.cfg.virtual_root) {
html_url_path(cgit_fileurl(ctx.qry.repo, "log", char *fileurl = cgit_fileurl(ctx.qry.repo, "log",
ctx.qry.vpath, NULL)); ctx.qry.vpath, NULL);
html_url_path(fileurl);
free(fileurl);
}
html("'>\n"); html("'>\n");
cgit_add_hidden_formfields(1, 0, "log"); cgit_add_hidden_formfields(1, 0, "log");
html("<select name='qt'>\n"); html("<select name='qt'>\n");