summaryrefslogtreecommitdiffstats
path: root/config.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-28 20:30:41 +0200
committerJunio C Hamano <gitster@pobox.com>2014-07-28 20:30:41 +0200
commitad524f834a9acaaaceeb846d00ea609f79333a3d (patch)
tree2b6a49037e48602c34dea27d19e0668ed8c35724 /config.c
parentt1402: check for refs ending with a dot (diff)
parentapply: avoid possible bogus pointer (diff)
downloadgit-ad524f834a9acaaaceeb846d00ea609f79333a3d.tar.xz
git-ad524f834a9acaaaceeb846d00ea609f79333a3d.zip
Merge branch 'jk/misc-fixes-maint'
* jk/misc-fixes-maint: apply: avoid possible bogus pointer fix memory leak parsing core.commentchar transport: fix leaks in refs_from_alternate_cb free ref string returned by dwim_ref receive-pack: don't copy "dir" parameter
Diffstat (limited to 'config.c')
-rw-r--r--config.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/config.c b/config.c
index 9767c4bad0..058505cb8d 100644
--- a/config.c
+++ b/config.c
@@ -817,14 +817,12 @@ static int git_default_core_config(const char *var, const char *value)
return git_config_string(&editor_program, var, value);
if (!strcmp(var, "core.commentchar")) {
- const char *comment;
- int ret = git_config_string(&comment, var, value);
- if (ret)
- return ret;
- else if (!strcasecmp(comment, "auto"))
+ if (!value)
+ return config_error_nonbool(var);
+ else if (!strcasecmp(value, "auto"))
auto_comment_line_char = 1;
- else if (comment[0] && !comment[1]) {
- comment_line_char = comment[0];
+ else if (value[0] && !value[1]) {
+ comment_line_char = value[0];
auto_comment_line_char = 0;
} else
return error("core.commentChar should only be one character");