From 5d8d28f039b4db7b4f040a40fdc2edf866200f0c Mon Sep 17 00:00:00 2001
From: Sup Yut Sum <ch3cooli@gmail.com>
Date: Sat, 1 Dec 2012 21:56:41 +0800
Subject: [PATCH] Also close config file handle when leaving
 git_config_set_multivar_in_file() early

Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
---
 config.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/config.c b/config.c
index fff8a43..4b5c877 100644
--- a/config.c
+++ b/config.c
@@ -1424,6 +1424,7 @@ int git_config_set_multivar_in_file(const char *config_filename,
 		contents = xmmap(NULL, contents_sz, PROT_READ,
 			MAP_PRIVATE, in_fd, 0);
 		close(in_fd);
+		in_fd = -1;
 
 		if (store.seen == 0)
 			store.seen = 1;
@@ -1493,6 +1494,8 @@ out_free:
 	if (lock)
 		rollback_lock_file(lock);
 	free(filename_buf);
+	if (in_fd >= 0)
+		close(in_fd);
 	return ret;
 
 write_err_out:
-- 
1.8.0.msysgit.0

