plug memory leak in sort_tree_entries_the_way_git_likes_it()
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) {