Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.zx2c4.com/cgit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cgit.c
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@gmail.com>2016-07-02 22:28:10 +0300
committerJason A. Donenfeld <Jason@zx2c4.com>2016-07-12 02:06:04 +0300
commitff9893ac8192579a00dd4c73ddff18ab232099a6 (patch)
tree2045ab39945aa86e6909b6ec2e5b0f6241cb8d80 /cgit.c
parentd6b0332982234c73a26119e4ed60d442870b8078 (diff)
Fix qry.head leak on error
This is run soon before exiting so it wasn't leaked for long. Signed-off-by: Richard Maw <richard.maw@gmail.com>
Diffstat (limited to 'cgit.c')
-rw-r--r--cgit.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/cgit.c b/cgit.c
index ab3fadb..9427c4a 100644
--- a/cgit.c
+++ b/cgit.c
@@ -616,11 +616,11 @@ static int prepare_repo_cmd(void)
}
if (get_sha1(ctx.qry.head, sha1)) {
- char *tmp = xstrdup(ctx.qry.head);
- ctx.qry.head = ctx.repo->defbranch;
+ char *old_head = ctx.qry.head;
+ ctx.qry.head = xstrdup(ctx.repo->defbranch);
cgit_print_error_page(404, "Not found",
- "Invalid branch: %s", tmp);
- free(tmp);
+ "Invalid branch: %s", old_head);
+ free(old_head);
return 1;
}
string_list_sort(&ctx.repo->submodules);