Commit d4af3990f62462c745856374cbe37a860bb57cf2

Stefan Sperling 2018-07-13T10:28:26

fix mem leaks in got_blame()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/lib/blame.c b/lib/blame.c
index 046ea38..0b6ffc0 100644
--- a/lib/blame.c
+++ b/lib/blame.c
@@ -421,10 +421,13 @@ got_blame(const char *path, struct got_object_id *start_commit_id,
 			break;
 
 		err = blame_line(&id, blame, lineno);
-		if (err)
+		if (err) {
+			free(line);
 			break;
+		}
 
 		err = got_object_id_str(&id_str, id);
+		free(id);
 		if (err) {
 			free(line);
 			break;