Commit dd4a654777079dd93bcf6c4aef22141460c154c0

Stefan Sperling 2019-08-17T10:17:49

plug memory leak in sort_tree_entries_the_way_git_likes_it()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/lib/object_create.c b/lib/object_create.c
index 2b08ba5..ac485f2 100644
--- a/lib/object_create.c
+++ b/lib/object_create.c
@@ -304,8 +304,10 @@ sort_tree_entries_the_way_git_likes_it(struct got_tree_entries **sorted,
 		if (err)
 			break;
 		err = insert_tree_entry(*sorted, new);
-		if (err)
+		if (err) {
+			got_object_tree_entry_close(new);
 			break;
+		}
 	}
 
 	if (err) {