Commit 1828273a5cb2731da90afc4d82058a176fd71b84

Stefan Sperling 2018-07-09T13:52:40

don't crash in 'got blame' error path

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/lib/blame.c b/lib/blame.c
index b3d6dbe..48042cc 100644
--- a/lib/blame.c
+++ b/lib/blame.c
@@ -269,9 +269,10 @@ done:
 		got_object_blob_close(blob);
 	if (commit)
 		got_object_commit_close(commit);
-	if (err)
-		blame_close(blame);
-	else
+	if (err) {
+		if (blame)
+			blame_close(blame);
+	} else
 		*blamep = blame;
 
 	return err;