blame: check error code when loading the mailmap Reported by Coverity, CID 1393484
diff --git a/src/blame.c b/src/blame.c
index fc87bd1..7a81a23 100644
--- a/src/blame.c
+++ b/src/blame.c
@@ -133,8 +133,11 @@ git_blame* git_blame__alloc(
return NULL;
}
- if (opts.flags & GIT_BLAME_USE_MAILMAP)
- git_mailmap_from_repository(&gbr->mailmap, repo);
+ if (opts.flags & GIT_BLAME_USE_MAILMAP &&
+ git_mailmap_from_repository(&gbr->mailmap, repo) < 0) {
+ git_blame_free(gbr);
+ return NULL;
+ }
return gbr;
}