Fix memleaks in Tree.EntryBy(Name/Path/Index), fixes #313 #365
Loading…
Reference in New Issue
No description provided.
Delete Branch "fix/memleak-tree-entrybyname"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This fixes a memory leak in the following methods:
Tree.EntryByName()
Tree.EntryByPath()
Tree.EntryById()
This issue was previously reported in https://github.com/libgit2/git2go/issues/313
I decided to use
defer
calls because it's cleaner and more consistent with the conventions used inside the codebase (@carlosmn, you mentioned using a local var in #313).In addition
go1.8
has halved the costs of defer calls, I think correctness comes before speed (premature optimization).