From 1e4ce4cdf86990d21197ca354a01d68f310db9a0 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:27:14 -0700 Subject: Pass request strings on without copying them --- source/ui-blame.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'source/ui-blame.c') diff --git a/source/ui-blame.c b/source/ui-blame.c index 48cbf8e..efa9470 100644 --- a/source/ui-blame.c +++ b/source/ui-blame.c @@ -24,7 +24,7 @@ enum blame_target { }; struct walk_tree_context { - char *rev; + const char *rev; int match_baselen; enum blame_target found; }; @@ -338,12 +338,9 @@ static void print_blame_page(const struct object_id *oid, const char *path, html("
");
 	if (ctx.repo->source_filter) {
-		char *filter_arg = xstrdup(filename);
-
-		cgit_open_filter(ctx.repo->source_filter, filter_arg);
+		cgit_open_filter(ctx.repo->source_filter, filename);
 		html_raw(buf, size);
 		cgit_close_filter(ctx.repo->source_filter);
-		free(filter_arg);
 	} else {
 		html_blob_txt(buf, size);
 	}
@@ -428,7 +425,7 @@ void cgit_print_blame(void)
 		return;
 	}
 
-	walk.rev = xstrdup(rev);
+	walk.rev = rev;
 	walk.match_baselen = path_items.match ? basedir_len(path_items.match) : -1;
 
 	read_tree(the_repository, repo_get_commit_tree(the_repository, commit), &paths, walk_tree, &walk);
@@ -436,6 +433,4 @@ void cgit_print_blame(void)
 		cgit_print_error_page(404, "Not Found", "Not found");
 	else if (walk.found == TARGET_FOLDER)
 		cgit_print_error_page(404, "Not Found", "Blame is not available for a directory");
-
-	free(walk.rev);
 }
-- 
cgit 2.11.1