diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-09-27 11:23:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-27 11:23:44 -0400 |
commit | 424812e3d874cc1320a1dd2067d870eb53569414 (patch) | |
tree | 78d2537028a7170463cf2320c02a6d602acc0766 | |
parent | 13f1270a7a8f99bfd5abdf5e374b7fc9634e18ae (diff) | |
parent | 581cfbda85939a5336fb39f6068b2c19ddd59f33 (diff) | |
download | libgit2-424812e3d874cc1320a1dd2067d870eb53569414.tar.gz |
Merge pull request #6071 from 257/examples
examples: Free the git_config and git_config_entry after use
-rw-r--r-- | examples/config.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/config.c b/examples/config.c index f7fa70e4d..6e14ce8c8 100644 --- a/examples/config.c +++ b/examples/config.c @@ -26,6 +26,10 @@ static int config_get(git_config *cfg, const char *key) } puts(entry->value); + + /* Free the git_config_entry after use with `git_config_entry_free()`. */ + git_config_entry_free(entry); + return 0; } @@ -57,6 +61,11 @@ int lg2_config(git_repository *repo, int argc, char **argv) error = 1; } + /** + * The configuration file must be freed once it's no longer + * being used by the user. + */ + git_config_free(cfg); out: return error; } |