Commit 8ecc5ae5cb5a1efed3c570511fecb6bfdd9cdbc3

Carlos Martín Nieto 2011-03-30T16:48:14

git_config_set_int: use the right buffer Signed-off-by: Carlos Martín Nieto <cmn@elego.de>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/config.c b/src/config.c
index b7af99c..13c32bc 100644
--- a/src/config.c
+++ b/src/config.c
@@ -222,12 +222,11 @@ int git_config_set_int(git_config *cfg, const char *name, int value)
 		buf_len = ret + 1;
 		help_buf = git__malloc(buf_len);
 		snprintf(help_buf, buf_len, "%d", value);
-	}
-
-	ret = config_set(cfg, name, str_value);
-
-	if (help_buf != NULL)
+		ret = config_set(cfg, name, help_buf);
 		free(help_buf);
+	} else {
+		ret = config_set(cfg, name, str_value);
+	}
 
 	return ret;
 }