Commit a8e4cb11fd77d52529e1e464df52a6db1aae33e7

Arthur Schreiber 2014-01-13T22:12:17

Fix a memory leak in `config_parse`.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/src/config_file.c b/src/config_file.c
index 2e78f7c..c7727c0 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -1072,8 +1072,10 @@ static int config_parse(diskfile_backend *cfg_file, struct reader *reader, git_c
 			git_buf_printf(&buf, "%s.%s", current_section, var_name);
 			git__free(var_name);
 
-			if (git_buf_oom(&buf))
+			if (git_buf_oom(&buf)) {
+				git__free(var_value);
 				return -1;
+			}
 
 			var->entry->name = git_buf_detach(&buf);
 			var->entry->value = var_value;