Skip to content

Conversation

@AaronO
Copy link
Contributor

@AaronO AaronO commented Feb 24, 2017

This fixes a memory leak in the following methods:

  • Tree.EntryByName()
  • Tree.EntryByPath()
  • Tree.EntryById()

This issue was previously reported in #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).

@carlosmn carlosmn merged commit 89fc9e7 into libgit2:master Apr 13, 2017
@AaronO AaronO deleted the fix/memleak-tree-entrybyname branch April 13, 2017 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants