Commit ad735bf3 by Patrick Steinhardt

diff_generate: detect memory allocation errors when preparing opts

When preparing options for the two iterators that are about to be
diffed, we allocate a common prefix for both iterators depending on
the options passed by the user. We do not check whether the allocation
was successful, though. In fact, this isn't much of a problem, as using
a `NULL` prefix is perfectly fine. But in the end, we probably want to
detect that the system doesn't have any memory left, as we're unlikely
to be able to continue afterwards anyway.

While the issue is being fixed in the newly created function
`diff_prepare_iterator_opts`, it has been previously existing in the
previous macro `DIFF_FROM_ITERATORS` already.
parent 7aa03e92
......@@ -1277,6 +1277,7 @@ static int diff_prepare_iterator_opts(char **prefix, git_iterator_options *a, in
b->pathlist.count = opts->pathspec.count;
} else if (opts) {
*prefix = git_pathspec_prefix(&opts->pathspec);
GIT_ERROR_CHECK_ALLOC(prefix);
}
a->flags = aflags;
......
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