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
+++ 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;
                }