git_tree_entry is marked as self freeing. But libgit2 only requires free'ing these in cases where the entry is retrieved from git_tree_entry_dup or git_tree_entry_bypath. Neither of which is exposed by nodegit. This can lead to memory corruption and/or double free.
I created #1332 to fix the issue.
Fairly easy to reproduce with the below running in a loop.
const builder = await git.Treebuilder.create(repository, null);
const oid = git.Oid.fromString("b45ef6fec89518d314f546fd6c3025367b721684");
for (let i = 0; i < 100; i++) {
builder.insert(
moniker.choose(),
oid,
parseInt("100644", 8));
}
builder.write();
git_tree_entry is marked as self freeing. But libgit2 only requires free'ing these in cases where the entry is retrieved from git_tree_entry_dup or git_tree_entry_bypath. Neither of which is exposed by nodegit. This can lead to memory corruption and/or double free.
I created #1332 to fix the issue.
Fairly easy to reproduce with the below running in a loop.