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>
This commit is contained in:
Richard Maw 2016-07-02 20:28:10 +01:00 υποβλήθηκε από Jason A. Donenfeld
γονέας d6b0332982
υποβολή ff9893ac81
1 αρχεία άλλαξαν με 4 προσθήκες και 4 διαγραφές

8
cgit.c

@ -616,11 +616,11 @@ static int prepare_repo_cmd(void)
} }
if (get_sha1(ctx.qry.head, sha1)) { if (get_sha1(ctx.qry.head, sha1)) {
char *tmp = xstrdup(ctx.qry.head); char *old_head = ctx.qry.head;
ctx.qry.head = ctx.repo->defbranch; ctx.qry.head = xstrdup(ctx.repo->defbranch);
cgit_print_error_page(404, "Not found", cgit_print_error_page(404, "Not found",
"Invalid branch: %s", tmp); "Invalid branch: %s", old_head);
free(tmp); free(old_head);
return 1; return 1;
} }
string_list_sort(&ctx.repo->submodules); string_list_sort(&ctx.repo->submodules);