neocgit

a more 'modern' version of cgit
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/neocgit

commit 6f2e4400faebd829f905c824400f933fe07f5c30
parent 3e244a0ccaef8303302a2c462f36b8bdf3634a46
Author: Christian Hesse <mail@eworm.de>
Date:   Fri,  9 Oct 2015 13:15:49 +0200

cmd: fix resource leak: free allocation from cgit_currenturl and fmtalloc

Signed-off-by: Christian Hesse <mail@eworm.de>

Diffstat:
Mcmd.c | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/cmd.c b/cmd.c @@ -41,9 +41,13 @@ static void about_fn(void) if (ctx.repo) { if (!ctx.qry.path && ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' && - ctx.env.path_info[strlen(ctx.env.path_info) - 1] != '/') - cgit_redirect(fmtalloc("%s/", cgit_currenturl()), true); - else + ctx.env.path_info[strlen(ctx.env.path_info) - 1] != '/') { + char *currenturl = cgit_currenturl(); + char *redirect = fmtalloc("%s/", currenturl); + cgit_redirect(redirect, true); + free(currenturl); + free(redirect); + } else cgit_print_repo_readme(ctx.qry.path); } else cgit_print_site_readme();