Commit 73427b94d649b64351837e09590409431f0687a9

Patrick Steinhardt 2019-06-27T13:23:17

Merge pull request #5142 from scottfurry/StaticChkFixExamples Resolve static check warnings in example code

diff --git a/examples/init.c b/examples/init.c
index 23044d1..e9841bc 100644
--- a/examples/init.c
+++ b/examples/init.c
@@ -244,5 +244,5 @@ static void parse_opts(struct opts *o, int argc, char *argv[])
 	}
 
 	if (!o->dir)
-		usage("must specify directory to init", NULL);
+		usage("must specify directory to init", "");
 }
diff --git a/examples/merge.c b/examples/merge.c
index 8ddb79b..25b0a69 100644
--- a/examples/merge.c
+++ b/examples/merge.c
@@ -220,6 +220,7 @@ static int create_merge_commit(git_repository *repo, git_index *index, merge_opt
 	check_lg2(git_repository_head(&head_ref, repo), "failed to get repo HEAD", NULL);
 	if (resolve_refish(&merge_commit, repo, opts->heads[0])) {
 		fprintf(stderr, "failed to resolve refish %s", opts->heads[0]);
+		free(parents);
 		return -1;
 	}