summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPaymon MARANDI <darwinskernel@gmail.com>2021-09-23 11:59:52 -0400
committerjrun <darwinskernel@gmail.com>2021-09-24 14:14:59 -0400
commit581cfbda85939a5336fb39f6068b2c19ddd59f33 (patch)
tree48803cd33cc63c03015446332b04789b3a9e81a7 /examples
parent136901086ecfdd2b5cc106782310355a9c0b1a9a (diff)
downloadlibgit2-581cfbda85939a5336fb39f6068b2c19ddd59f33.tar.gz
examples: Free the git_config and git_config_entry after use
Diffstat (limited to 'examples')
-rw-r--r--examples/config.c9
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;
}