about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ui-tree.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ui-tree.c b/ui-tree.c
index 561f9e7..b692b56 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -271,7 +271,6 @@ void cgit_print_tree(const char *rev, char *path)
 	if (!rev)
 		rev = ctx.qry.head;
 
-	walk_tree_ctx.curr_rev = xstrdup(rev);
 	if (get_sha1(rev, sha1)) {
 		cgit_print_error(fmt("Invalid revision name: %s", rev));
 		return;
@@ -282,12 +281,17 @@ void cgit_print_tree(const char *rev, char *path)
 		return;
 	}
 
+	walk_tree_ctx.curr_rev = xstrdup(rev);
+
 	if (path == NULL) {
 		ls_tree(commit->tree->object.sha1, NULL, &walk_tree_ctx);
-		return;
+		goto cleanup;
 	}
 
 	read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
 	if (walk_tree_ctx.state == 1)
 		ls_tail();
+
+cleanup:
+	free(walk_tree_ctx.curr_rev);
 }
6c5f7d329a979aa36e5c66d9affe529ea852d&follow=1'>Add hi -nJune McEnroe 2019-02-08Elaborate hi man pageJune McEnroe 2019-02-08Use set for parent in hiJune McEnroe 2019-02-08Switch back to semantic keyword grouping in hiJune McEnroe 2019-02-08Match only the basename in hiJune McEnroe 2019-02-07Add mdoc syntax to hiJune McEnroe 2019-02-07Support multi-line C macros in hiJune McEnroe 2019-02-07Detect .mk files as makeJune McEnroe 2019-02-07Add make syntax to hiJune McEnroe 2019-02-07Add IRC output to hiJune McEnroe 2019-02-07Improve C syntax accuracy and add Format classJune McEnroe 2019-02-07Factor out hi checkJune McEnroe Fix subexpression bounds check and compile pattends. 2019-02-07Add Escape class to hiJune McEnroe 2019-02-07Add Todo class and parent syntax constraintJune McEnroe