Commit a2687442f1037768cb6c2a3ab56828e26d465c9d

Klemens Nanni 2019-11-30T02:40:53

got: start_commit and search_pattern ought to be const Must not be passed to free(3), holds argv[] input.

diff --git a/got/got.c b/got/got.c
index 05082c9..756eaa2 100644
--- a/got/got.c
+++ b/got/got.c
@@ -1732,9 +1732,8 @@ print_commit(struct got_commit_object *commit, struct got_object_id *id,
 
 static const struct got_error *
 print_commits(struct got_object_id *root_id, struct got_repository *repo,
-    const char *path, int show_patch, const char *search_pattern,
-    int diff_context, int limit, int first_parent_traversal,
-    struct got_reflist_head *refs)
+    char *path, int show_patch, char *search_pattern, int diff_context,
+    int limit, int first_parent_traversal, struct got_reflist_head *refs)
 {
 	const struct got_error *err;
 	struct got_commit_graph *graph;
@@ -1840,7 +1839,7 @@ cmd_log(int argc, char *argv[])
 	struct got_commit_object *commit = NULL;
 	struct got_object_id *id = NULL;
 	char *repo_path = NULL, *path = NULL, *cwd = NULL, *in_repo_path = NULL;
-	const char *start_commit = NULL, *search_pattern = NULL;
+	char *start_commit = NULL, *search_pattern = NULL;
 	int diff_context = -1, ch;
 	int show_patch = 0, limit = 0, first_parent_traversal = 0;
 	const char *errstr;