mirror of
https://git.zx2c4.com/cgit
synced 2024-11-22 16:38:42 +00:00
ui-shared: fix resource leak: free allocation from cgit_currenturl
Coverity-id: 13927 Signed-off-by: Christian Hesse <mail@eworm.de>
This commit is contained in:
parent
c5c0eb873e
commit
3e244a0cca
11
ui-shared.c
11
ui-shared.c
@ -157,8 +157,11 @@ static void site_url(const char *page, const char *search, const char *sort, int
|
|||||||
|
|
||||||
if (always_root || page)
|
if (always_root || page)
|
||||||
html_attr(cgit_rooturl());
|
html_attr(cgit_rooturl());
|
||||||
else
|
else {
|
||||||
html_attr(cgit_currenturl());
|
char *currenturl = cgit_currenturl();
|
||||||
|
html_attr(currenturl);
|
||||||
|
free(currenturl);
|
||||||
|
}
|
||||||
|
|
||||||
if (page) {
|
if (page) {
|
||||||
htmlf("?p=%s", page);
|
htmlf("?p=%s", page);
|
||||||
@ -1020,19 +1023,21 @@ void cgit_print_pageheader(void)
|
|||||||
html("<input type='submit' value='search'/>\n");
|
html("<input type='submit' value='search'/>\n");
|
||||||
html("</form>\n");
|
html("</form>\n");
|
||||||
} else if (ctx.env.authenticated) {
|
} else if (ctx.env.authenticated) {
|
||||||
|
char *currenturl = cgit_currenturl();
|
||||||
site_link(NULL, "index", NULL, hc("repolist"), NULL, NULL, 0, 1);
|
site_link(NULL, "index", NULL, hc("repolist"), NULL, NULL, 0, 1);
|
||||||
if (ctx.cfg.root_readme)
|
if (ctx.cfg.root_readme)
|
||||||
site_link("about", "about", NULL, hc("about"),
|
site_link("about", "about", NULL, hc("about"),
|
||||||
NULL, NULL, 0, 1);
|
NULL, NULL, 0, 1);
|
||||||
html("</td><td class='form'>");
|
html("</td><td class='form'>");
|
||||||
html("<form method='get' action='");
|
html("<form method='get' action='");
|
||||||
html_attr(cgit_currenturl());
|
html_attr(currenturl);
|
||||||
html("'>\n");
|
html("'>\n");
|
||||||
html("<input type='text' name='q' size='10' value='");
|
html("<input type='text' name='q' size='10' value='");
|
||||||
html_attr(ctx.qry.search);
|
html_attr(ctx.qry.search);
|
||||||
html("'/>\n");
|
html("'/>\n");
|
||||||
html("<input type='submit' value='search'/>\n");
|
html("<input type='submit' value='search'/>\n");
|
||||||
html("</form>");
|
html("</form>");
|
||||||
|
free(currenturl);
|
||||||
}
|
}
|
||||||
html("</td></tr></table>\n");
|
html("</td></tr></table>\n");
|
||||||
if (ctx.env.authenticated && ctx.qry.vpath) {
|
if (ctx.env.authenticated && ctx.qry.vpath) {
|
||||||
|
Loading…
Reference in New Issue
Block a user