[PATCH 2/4] scan-tree: remove useless strdup()

John Keeping john at keeping.me.uk
Fri Oct 9 00:23:57 CEST 2015


parse_configfile() takes a "const char *" and doesn't hold any
references to it after it returns; there is no reason to pass it a
duplicate.

Coverity-id: 13941
Signed-off-by: John Keeping <john at keeping.me.uk>
---
 scan-tree.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scan-tree.c b/scan-tree.c
index 8e3cf52..b5a10ff 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -174,7 +174,7 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn)
 
 	strbuf_addstr(path, "cgitrc");
 	if (!stat(path->buf, &st))
-		parse_configfile(xstrdup(path->buf), &repo_config);
+		parse_configfile(path->buf, &repo_config);
 
 	strbuf_release(&rel);
 }
-- 
1.7.9.5



More information about the CGit mailing list