Commit ca9bbcb5d9866b3b158c37e20a6d46406d2f7aa3

Etienne Samson 2018-06-19T20:15:02

blame: check error code when loading the mailmap Reported by Coverity, CID 1393484

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
 }