aboutsummaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorChristian Hesse2015-10-09 13:15:49 +0200
committerJason A. Donenfeld2015-10-09 14:03:58 +0200
commit6f2e4400faebd829f905c824400f933fe07f5c30 (patch)
tree576519325e258cbf8ca78a3c22fa20689516cbe8 /cmd.c
parent3e244a0ccaef8303302a2c462f36b8bdf3634a46 (diff)
downloadcgit-6f2e4400faebd829f905c824400f933fe07f5c30.tar.gz
cgit-6f2e4400faebd829f905c824400f933fe07f5c30.tar.bz2
cgit-6f2e4400faebd829f905c824400f933fe07f5c30.zip
cmd: fix resource leak: free allocation from cgit_currenturl and fmtalloc
Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd.c b/cmd.c
index c991092..3093c62 100644
--- a/cmd.c
+++ b/cmd.c
@@ -41,9 +41,13 @@ static void about_fn(void)
41 if (ctx.repo) { 41 if (ctx.repo) {
42 if (!ctx.qry.path && 42 if (!ctx.qry.path &&
43 ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' && 43 ctx.qry.url[strlen(ctx.qry.url) - 1] != '/' &&
44 ctx.env.path_info[strlen(ctx.env.path_info) - 1] != '/') 44 ctx.env.path_info[strlen(ctx.env.path_info) - 1] != '/') {
45 cgit_redirect(fmtalloc("%s/", cgit_currenturl()), true); 45 char *currenturl = cgit_currenturl();
46 else 46 char *redirect = fmtalloc("%s/", currenturl);
47 cgit_redirect(redirect, true);
48 free(currenturl);
49 free(redirect);
50 } else
47 cgit_print_repo_readme(ctx.qry.path); 51 cgit_print_repo_readme(ctx.qry.path);
48 } else 52 } else
49 cgit_print_site_readme(); 53 cgit_print_site_readme();