mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 17:46:09 +00:00
Plug a few leaks
This commit is contained in:
parent
1694a63994
commit
f5c874a475
@ -667,6 +667,7 @@ done:
|
||||
static void tree_iterator_frame_pop(tree_iterator *iter)
|
||||
{
|
||||
tree_iterator_frame *frame;
|
||||
git_buf *buf = NULL;
|
||||
|
||||
assert(iter->frames.size);
|
||||
|
||||
@ -674,6 +675,14 @@ static void tree_iterator_frame_pop(tree_iterator *iter)
|
||||
|
||||
git_vector_free(&frame->entries);
|
||||
git_tree_free(frame->tree);
|
||||
|
||||
do {
|
||||
buf = git_array_pop(frame->similar_paths);
|
||||
git_buf_free(buf);
|
||||
} while (buf != NULL);
|
||||
|
||||
git_array_clear(frame->similar_paths);
|
||||
git_buf_free(&frame->path);
|
||||
}
|
||||
|
||||
static int tree_iterator_current(
|
||||
@ -1760,6 +1769,10 @@ static int filesystem_iterator_reset(git_iterator *i)
|
||||
static void filesystem_iterator_free(git_iterator *i)
|
||||
{
|
||||
filesystem_iterator *iter = (filesystem_iterator *)i;
|
||||
git__free(iter->root);
|
||||
git_buf_free(&iter->current_path);
|
||||
if (iter->index)
|
||||
git_index_snapshot_release(&iter->index_snapshot, iter->index);
|
||||
filesystem_iterator_clear(iter);
|
||||
}
|
||||
|
||||
@ -1823,6 +1836,7 @@ static int iterator_for_filesystem(
|
||||
(error = git_index_snapshot_new(&iter->index_snapshot, index)) < 0)
|
||||
goto on_error;
|
||||
|
||||
iter->index = index;
|
||||
iter->dirload_flags =
|
||||
(iterator__ignore_case(&iter->base) ? GIT_PATH_DIR_IGNORE_CASE : 0) |
|
||||
(iterator__flag(&iter->base, PRECOMPOSE_UNICODE) ?
|
||||
|
@ -837,6 +837,8 @@ int git_treebuilder_write(git_oid *oid, git_treebuilder *bld)
|
||||
error = git_odb_write(oid, odb, tree.ptr, tree.size, GIT_OBJ_TREE);
|
||||
|
||||
git_buf_free(&tree);
|
||||
git_vector_free(&entries);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -51,5 +51,7 @@ void test_core_array__bsearch2(void)
|
||||
expect_pos(50, 10, GIT_ENOTFOUND);
|
||||
expect_pos(68, 10, GIT_ENOTFOUND);
|
||||
expect_pos(256, 12, GIT_OK);
|
||||
|
||||
git_array_clear(integers);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user