Skip to content

Commit 94e30d9

Browse files
committed
config: check for OOM when writing
1 parent ba1afdc commit 94e30d9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/config_file.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,10 +1955,12 @@ static int config_write(diskfile_backend *cfg, const char *orig_key, const char
19551955
ldot = strrchr(key, '.');
19561956
name = ldot + 1;
19571957
section = git__strndup(key, ldot - key);
1958+
GITERR_CHECK_ALLOC(section);
19581959

19591960
ldot = strrchr(orig_key, '.');
19601961
orig_name = ldot + 1;
19611962
orig_section = git__strndup(orig_key, ldot - orig_key);
1963+
GITERR_CHECK_ALLOC(orig_section);
19621964

19631965
write_data.buf = &buf;
19641966
git_buf_init(&write_data.buffered_comment, 0);

0 commit comments

Comments
 (0)