Commit 94e30d9b by Carlos Martín Nieto

config: check for OOM when writing

parent ba1afdc3
...@@ -1955,10 +1955,12 @@ static int config_write(diskfile_backend *cfg, const char *orig_key, const char ...@@ -1955,10 +1955,12 @@ static int config_write(diskfile_backend *cfg, const char *orig_key, const char
ldot = strrchr(key, '.'); ldot = strrchr(key, '.');
name = ldot + 1; name = ldot + 1;
section = git__strndup(key, ldot - key); section = git__strndup(key, ldot - key);
GITERR_CHECK_ALLOC(section);
ldot = strrchr(orig_key, '.'); ldot = strrchr(orig_key, '.');
orig_name = ldot + 1; orig_name = ldot + 1;
orig_section = git__strndup(orig_key, ldot - orig_key); orig_section = git__strndup(orig_key, ldot - orig_key);
GITERR_CHECK_ALLOC(orig_section);
write_data.buf = &buf; write_data.buf = &buf;
git_buf_init(&write_data.buffered_comment, 0); git_buf_init(&write_data.buffered_comment, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment