Added call to git_libgit2_shutdown()

Added forgotten call to git_libgit2_shutdown() to the /examples/network/git2.c.
This commit is contained in:
Tomas Paladin Volf 2015-04-30 15:10:28 +02:00
parent 891cc5045f
commit 9bff15f4a4

View File

@ -23,6 +23,8 @@ static int run_command(git_cb fn, int argc, char **argv)
int error; int error;
git_repository *repo; git_repository *repo;
git_libgit2_init();
// Before running the actual command, create an instance of the local // Before running the actual command, create an instance of the local
// repository and pass it to the function. // repository and pass it to the function.
@ -42,6 +44,8 @@ static int run_command(git_cb fn, int argc, char **argv)
if(repo) if(repo)
git_repository_free(repo); git_repository_free(repo);
git_libgit2_shutdown();
return !!error; return !!error;
} }
@ -54,8 +58,6 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
git_libgit2_init();
for (i = 0; commands[i].name != NULL; ++i) { for (i = 0; commands[i].name != NULL; ++i) {
if (!strcmp(argv[1], commands[i].name)) if (!strcmp(argv[1], commands[i].name))
return run_command(commands[i].fn, --argc, ++argv); return run_command(commands[i].fn, --argc, ++argv);