Merge branch 'ss/fix-config-fd-leak'
authorJunio C Hamano <gitster@pobox.com>
Wed, 26 Aug 2015 22:45:30 +0000 (15:45 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Aug 2015 22:45:30 +0000 (15:45 -0700)
* ss/fix-config-fd-leak:
config: close config file handle in case of error

1  2 
config.c
diff --cc config.c
index a34b850cdc3f6902882c04f925456b4877978729,83caa2546ee2e93bfb5cb1269bde4ea4e983a9f3..c027e6fbe035e118cc461423f935714e30d6768c
+++ b/config.c
@@@ -2065,10 -2065,11 +2065,11 @@@ int git_config_set_multivar_in_file(con
                        goto out_free;
                }
                close(in_fd);
+               in_fd = -1;
  
 -              if (chmod(lock->filename.buf, st.st_mode & 07777) < 0) {
 +              if (chmod(get_lock_file_path(lock), st.st_mode & 07777) < 0) {
                        error("chmod on %s failed: %s",
 -                              lock->filename.buf, strerror(errno));
 +                            get_lock_file_path(lock), strerror(errno));
                        ret = CONFIG_NO_WRITE;
                        goto out_free;
                }