Commit 581cfbda by Paymon MARANDI Committed by jrun

examples: Free the git_config and git_config_entry after use

parent 13690108
...@@ -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