Commit f5c874a4 by Carlos Martín Nieto Committed by Edward Thomson

Plug a few leaks

parent 1694a639
......@@ -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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment