History

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

Christian Hesse committed 11 years ago

Commit 37fce991 parent fa5810e1 file · +11 −5Browse files

Unified · Split

ui-shared.c+11−5
@@ -746,16 +746,19 @@ void cgit_print_docstart(void) · 745 unmodified lines
746 html("'/>\n");746 html("'/>\n");
747 }747 }
748 if (host && ctx.repo && ctx.qry.head) {748 if (host && ctx.repo && ctx.qry.head) {
749 char *fileurl;
749 struct strbuf sb = STRBUF_INIT;750 struct strbuf sb = STRBUF_INIT;
750 strbuf_addf(&sb, "h=%s", ctx.qry.head);751 strbuf_addf(&sb, "h=%s", ctx.qry.head);
751 752
752 html("<link rel='alternate' title='Atom feed' href='");753 html("<link rel='alternate' title='Atom feed' href='");
753 html(cgit_httpscheme());754 html(cgit_httpscheme());
754 html_attr(cgit_hosturl());755 html_attr(cgit_hosturl());
755 html_attr(cgit_fileurl(ctx.repo->url, "atom", ctx.qry.vpath,756 fileurl = cgit_fileurl(ctx.repo->url, "atom", ctx.qry.vpath,
756 sb.buf));757 sb.buf);
758 html_attr(fileurl);
757 html("' type='application/atom+xml'/>\n");759 html("' type='application/atom+xml'/>\n");
758 strbuf_release(&sb);760 strbuf_release(&sb);
761 free(fileurl);
759 }762 }
760 if (ctx.repo)763 if (ctx.repo)
761 cgit_add_clone_urls(print_rel_vcs_link);764 cgit_add_clone_urls(print_rel_vcs_link);
@@ -997,9 +1000,12 @@ void cgit_print_pageheader(void) · 235 unmodified lines
997 ctx.qry.head, ctx.qry.vpath);1000 ctx.qry.head, ctx.qry.vpath);
998 html("</td><td class='form'>");1001 html("</td><td class='form'>");
999 html("<form class='right' method='get' action='");1002 html("<form class='right' method='get' action='");
1000 if (ctx.cfg.virtual_root)1003 if (ctx.cfg.virtual_root) {
1001 html_url_path(cgit_fileurl(ctx.qry.repo, "log",1004 char *fileurl = cgit_fileurl(ctx.qry.repo, "log",
1002 ctx.qry.vpath, NULL));1005 ctx.qry.vpath, NULL);
1006 html_url_path(fileurl);
1007 free(fileurl);
1008 }
1003 html("'>\n");1009 html("'>\n");
1004 cgit_add_hidden_formfields(1, 0, "log");1010 cgit_add_hidden_formfields(1, 0, "log");
1005 html("<select name='qt'>\n");1011 html("<select name='qt'>\n");