Commit df9513f185a849a6087d336a99697e2ce2488fc6

Stefan Sperling 2018-07-13T11:02:06

fix mem leak in blame_changes() error path

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/lib/blame.c b/lib/blame.c
index bcd2b1e..fdaf2c0 100644
--- a/lib/blame.c
+++ b/lib/blame.c
@@ -168,8 +168,10 @@ blame_changes(struct got_blame *blame, struct got_diff_changes *changes,
 
 		err = got_diffoffset_add(diff_offsets->chunks,
 		    old_lineno, old_length, new_lineno, new_length);
-		if (err)
+		if (err) {
+			free_diff_offsets(diff_offsets);
 			return err;
+		}
 	}
 	SLIST_INSERT_HEAD(&blame->diff_offsets_list, diff_offsets, entry);