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 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>
| -rw-r--r-- | cmd.c | 10 |
1 files changed, 7 insertions, 3 deletions
| @@ -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(); |
