- char *tmp = xstrdup(ctx.qry.head);
- ctx.qry.head = ctx.repo->defbranch;
- ctx.page.status = 404;
- ctx.page.statusmsg = "Not found";
- cgit_print_http_headers();
- cgit_print_docstart();
- cgit_print_pageheader();
- cgit_print_error("Invalid branch: %s", tmp);
- cgit_print_docend();
- free(tmp);
+ char *old_head = ctx.qry.head;
+ ctx.qry.head = xstrdup(ctx.repo->defbranch);
+ cgit_print_error_page(404, "Not found",
+ "Invalid branch: %s", old_head);
+ free(old_head);