summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-03-20 12:38:28 +0100
committerPatrick Steinhardt <ps@pks.im>2017-03-21 15:48:16 +0100
commite7330016af5603021e9521c836b266295a1f2416 (patch)
tree1a346a518345d6c87a30335f62a0148ae1d96cac
parent723bdf48641736ece6a03032bae514ef28979dfe (diff)
downloadlibgit2-e7330016af5603021e9521c836b266295a1f2416.tar.gz
diff_parse: check return value of `git_diff_init_options`
-rw-r--r--src/diff_parse.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/diff_parse.c b/src/diff_parse.c
index 93915683e..24a8a4af6 100644
--- a/src/diff_parse.c
+++ b/src/diff_parse.c
@@ -44,7 +44,11 @@ static git_diff_parsed *diff_parsed_alloc(void)
diff->base.patch_fn = git_patch_parsed_from_diff;
diff->base.free_fn = diff_parsed_free;
- git_diff_init_options(&diff->base.opts, GIT_DIFF_OPTIONS_VERSION);
+ if (git_diff_init_options(&diff->base.opts, GIT_DIFF_OPTIONS_VERSION) < 0) {
+ git__free(&diff);
+ return NULL;
+ }
+
diff->base.opts.flags &= ~GIT_DIFF_IGNORE_CASE;
git_pool_init(&diff->base.pool, 1);