Fix some memory leaks
diff --git a/src/index.c b/src/index.c
index 25c38b0..fd55616 100644
--- a/src/index.c
+++ b/src/index.c
@@ -2030,6 +2030,8 @@ int git_index_read_tree(git_index *index, const git_tree *tree)
error = git_tree_walk(tree, GIT_TREEWALK_POST, read_tree_cb, &data);
index_entries_free(&entries);
+ git_vector_free(&entries);
+
git_vector_sort(&index->entries);
return error;
diff --git a/src/remote.c b/src/remote.c
index 943b72b..0e8354a 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -1267,8 +1267,10 @@ static int rename_remote_references(
return -1;
while ((error = git_reference_next(&ref, iter)) == 0) {
- if (git__prefixcmp(ref->name, GIT_REFS_REMOTES_DIR))
+ if (git__prefixcmp(ref->name, GIT_REFS_REMOTES_DIR)) {
+ git_reference_free(ref);
continue;
+ }
if ((error = rename_one_remote_reference(ref, old_name, new_name)) < 0) {
git_reference_iterator_free(iter);