mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 01:27:05 +00:00
blame_git: check return value of git__calloc
We do not check the return value of `git__calloc`, which may return `NULL` in out-of-memory situations. Fix the error by using `GITERR_CHECK_ALLOC`.
This commit is contained in:
parent
a76d75021c
commit
756138e475
@ -517,11 +517,12 @@ static int pass_blame(git_blame *blame, git_blame__origin *origin, uint32_t opt)
|
|||||||
if (!num_parents) {
|
if (!num_parents) {
|
||||||
git_oid_cpy(&blame->options.oldest_commit, git_commit_id(commit));
|
git_oid_cpy(&blame->options.oldest_commit, git_commit_id(commit));
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
} else if (num_parents < (int)ARRAY_SIZE(sg_buf))
|
||||||
else if (num_parents < (int)ARRAY_SIZE(sg_buf))
|
|
||||||
memset(sg_buf, 0, sizeof(sg_buf));
|
memset(sg_buf, 0, sizeof(sg_buf));
|
||||||
else
|
else {
|
||||||
sg_origin = git__calloc(num_parents, sizeof(*sg_origin));
|
sg_origin = git__calloc(num_parents, sizeof(*sg_origin));
|
||||||
|
GITERR_CHECK_ALLOC(sg_origin);
|
||||||
|
}
|
||||||
|
|
||||||
for (i=0; i<num_parents; i++) {
|
for (i=0; i<num_parents; i++) {
|
||||||
git_commit *p;
|
git_commit *p;
|
||||||
|
Loading…
Reference in New Issue
Block a user