Unverified Commit 424812e3 by Edward Thomson Committed by GitHub

Merge pull request #6071 from 257/examples

examples: Free the git_config and git_config_entry after use
parents 13f1270a 581cfbda
...@@ -26,6 +26,10 @@ static int config_get(git_config *cfg, const char *key) ...@@ -26,6 +26,10 @@ static int config_get(git_config *cfg, const char *key)
} }
puts(entry->value); puts(entry->value);
/* Free the git_config_entry after use with `git_config_entry_free()`. */
git_config_entry_free(entry);
return 0; return 0;
} }
...@@ -57,6 +61,11 @@ int lg2_config(git_repository *repo, int argc, char **argv) ...@@ -57,6 +61,11 @@ int lg2_config(git_repository *repo, int argc, char **argv)
error = 1; error = 1;
} }
/**
* The configuration file must be freed once it's no longer
* being used by the user.
*/
git_config_free(cfg);
out: out:
return error; return error;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment