diff options
author | Christian Hesse | 2015-10-09 13:15:49 +0200 |
---|---|---|
committer | Jason A. Donenfeld | 2015-10-09 14:03:58 +0200 |
commit | 6f2e4400faebd829f905c824400f933fe07f5c30 (patch) | |
tree | 576519325e258cbf8ca78a3c22fa20689516cbe8 | |
parent | 3e244a0ccaef8303302a2c462f36b8bdf3634a46 (diff) | |
download | cgit-6f2e4400faebd829f905c824400f933fe07f5c30.tar.gz |
cmd: fix resource leak: free allocation from cgit_currenturl and fmtalloc
Signed-off-by: Christian Hesse <mail@eworm.de>
-rw-r--r-- | cmd.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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(); |