diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-03-20 15:16:07 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-03-20 15:16:07 +0900 |
commit | 6b5688b760a11430586122173d96b15fd3204308 (patch) | |
tree | ddb27de68f656862e068bb51b97967c3afea6b31 /builtin/init-db.c | |
parent | Merge branch 'jk/virtual-objects-do-exist' (diff) | |
parent | setup: fix memory leaks with `struct repository_format` (diff) | |
download | tgif-6b5688b760a11430586122173d96b15fd3204308.tar.xz |
Merge branch 'ma/clear-repository-format'
The setup code has been cleaned up to avoid leaks around the
repository_format structure.
* ma/clear-repository-format:
setup: fix memory leaks with `struct repository_format`
setup: free old value before setting `work_tree`
Diffstat (limited to 'builtin/init-db.c')
-rw-r--r-- | builtin/init-db.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c index 93eff7618c..6090217025 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -96,7 +96,7 @@ static void copy_templates(const char *template_dir) struct strbuf path = STRBUF_INIT; struct strbuf template_path = STRBUF_INIT; size_t template_len; - struct repository_format template_format; + struct repository_format template_format = REPOSITORY_FORMAT_INIT; struct strbuf err = STRBUF_INIT; DIR *dir; char *to_free = NULL; @@ -148,6 +148,7 @@ free_return: free(to_free); strbuf_release(&path); strbuf_release(&template_path); + clear_repository_format(&template_format); } static int git_init_db_config(const char *k, const char *v, void *cb) |