Merge branch 'ma/clear-repository-format'
authorJunio C Hamano <gitster@pobox.com>
Wed, 20 Mar 2019 06:16:07 +0000 (15:16 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 Mar 2019 06:16:07 +0000 (15:16 +0900)
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`

1  2 
builtin/init-db.c
cache.h
repository.c
setup.c

Simple merge
diff --cc cache.h
Simple merge
diff --cc repository.c
Simple merge
diff --cc setup.c
+++ b/setup.c
@@@ -1044,8 -1068,8 +1058,8 @@@ const char *setup_git_directory_gently(
  {
        static struct strbuf cwd = STRBUF_INIT;
        struct strbuf dir = STRBUF_INIT, gitdir = STRBUF_INIT;
 -      const char *prefix;
 +      const char *prefix = NULL;
-       struct repository_format repo_fmt;
+       struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT;
  
        /*
         * We may have read an incomplete configuration before