Commit 3affba96cf2f8128eea9145e7f67e254dfde02df

Stefan Sperling 2019-09-22T11:11:08

missing NULL check

diff --git a/got/got.c b/got/got.c
index 6f3b569..bc507c2 100644
--- a/got/got.c
+++ b/got/got.c
@@ -2626,12 +2626,14 @@ done:
 		if (error == NULL)
 			error = repo_error;
 	}
-	for (i = 0; i < bca.nlines; i++) {
-		struct blame_line *bline = &bca.lines[i];
-		free(bline->id_str);
-		free(bline->committer);
+	if (bca.lines) {
+		for (i = 0; i < bca.nlines; i++) {
+			struct blame_line *bline = &bca.lines[i];
+			free(bline->id_str);
+			free(bline->committer);
+		}
+		free(bca.lines);
 	}
-	free(bca.lines);
 	free(bca.line_offsets);
 	if (bca.f && fclose(bca.f) == EOF && error == NULL)
 		error = got_error_from_errno("fclose");