all repos — cgit @ ff9893ac8192579a00dd4c73ddff18ab232099a6

a hyperfast web frontend for git written in c

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>
Richard Maw richard.maw@gmail.com
Sat, 02 Jul 2016 20:28:10 +0100
commit

ff9893ac8192579a00dd4c73ddff18ab232099a6

parent

d6b0332982234c73a26119e4ed60d442870b8078

1 files changed, 4 insertions(+), 4 deletions(-)

jump to
M cgit.ccgit.c

@@ -616,11 +616,11 @@ return 1;

} 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);