summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2017-10-30 15:55:18 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2017-10-30 15:55:18 +0100
commit94e30d9b14b96283295b107268a862d37a96894f (patch)
tree63b55b7a2a589d20a1f6ebac86444ca9e90139a2
parentba1afdc373b5aed7c7451d9cfd59117d71f94fd6 (diff)
downloadlibgit2-cmn/config-write-preserve-case.tar.gz
config: check for OOM when writingcmn/config-write-preserve-case
-rw-r--r--src/config_file.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/config_file.c b/src/config_file.c
index 73c90007b..9a6d81516 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -1955,10 +1955,12 @@ static int config_write(diskfile_backend *cfg, const char *orig_key, const char
ldot = strrchr(key, '.');
name = ldot + 1;
section = git__strndup(key, ldot - key);
+ GITERR_CHECK_ALLOC(section);
ldot = strrchr(orig_key, '.');
orig_name = ldot + 1;
orig_section = git__strndup(orig_key, ldot - orig_key);
+ GITERR_CHECK_ALLOC(orig_section);
write_data.buf = &buf;
git_buf_init(&write_data.buffered_comment, 0);