diff options
author | Christian Hesse | 2015-10-09 13:15:46 +0200 |
---|---|---|
committer | Jason A. Donenfeld | 2015-10-09 13:59:46 +0200 |
commit | 37fce9916a264e23c0639df56ca3ecbbdc1c84b8 (patch) | |
tree | 346ca5cd10b73de63da8b3732f5618d1b13396cf /ui-shared.c | |
parent | ui-ssdiff: fix resource leak: free allocation from cgit_fileurl (diff) | |
download | cgit-37fce9916a264e23c0639df56ca3ecbbdc1c84b8.tar.gz cgit-37fce9916a264e23c0639df56ca3ecbbdc1c84b8.zip |
ui-shared: fix resource leak: free allocation from cgit_fileurl
Coverity-id: 13918 Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ui-shared.c b/ui-shared.c index 89c4897..d9f8258 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -746,16 +746,19 @@ void cgit_print_docstart(void) | |||
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) | |||
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"); |