diff options
author | Tobias Nießen <tniessen@tnie.de> | 2019-04-16 18:13:31 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2019-05-02 10:22:13 +0200 |
commit | 4ec32d3652b6c9f3441eab5b0868621c450acd20 (patch) | |
tree | f5ada997a6e68cabb41c513bc9ad4b28278883cc | |
parent | 9b6989789de603fa25a752def6f984cea4958944 (diff) | |
download | libgit2-4ec32d3652b6c9f3441eab5b0868621c450acd20.tar.gz |
config_file: check result of git_array_alloc
git_array_alloc can return NULL if no memory is available, causing
a segmentation fault in memset. This adds GIT_ERROR_CHECK_ALLOC
similar to how other parts of the code base deal with the return
value of git_array_alloc.
-rw-r--r-- | src/config_file.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/config_file.c b/src/config_file.c index 26c9e5ed2..7f8dd650e 100644 --- a/src/config_file.c +++ b/src/config_file.c @@ -678,6 +678,7 @@ static int parse_include(git_config_parser *reader, return result; include = git_array_alloc(reader->file->includes); + GIT_ERROR_CHECK_ALLOC(include); memset(include, 0, sizeof(*include)); git_array_init(include->includes); include->path = git_buf_detach(&path); |