[PATCH 01/17] Fix qry.head leak on error
Richard Maw
richard.maw at gmail.com
Sat Jul 2 21:28:10 CEST 2016
This is run soon before exiting so it wasn't leaked for long.
Signed-off-by: Richard Maw <richard.maw at gmail.com>
---
cgit.c | 8 ++++----
1 file 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);
--
2.9.0
More information about the CGit
mailing list