{"action":"closed","issue":{"url":"https://api.github.com/repos/libgit2/git2go/issues/209","labels_url":"https://api.github.com/repos/libgit2/git2go/issues/209/labels{/name}","comments_url":"https://api.github.com/repos/libgit2/git2go/issues/209/comments","events_url":"https://api.github.com/repos/libgit2/git2go/issues/209/events","html_url":"https://github.com/libgit2/git2go/issues/209","id":85476750,"number":209,"title":"Is defer commit.Free() necessary?","user":{"login":"shinningstar","id":2812113,"avatar_url":"https://avatars.githubusercontent.com/u/2812113?v=3","gravatar_id":"","url":"https://api.github.com/users/shinningstar","html_url":"https://github.com/shinningstar","followers_url":"https://api.github.com/users/shinningstar/followers","following_url":"https://api.github.com/users/shinningstar/following{/other_user}","gists_url":"https://api.github.com/users/shinningstar/gists{/gist_id}","starred_url":"https://api.github.com/users/shinningstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shinningstar/subscriptions","organizations_url":"https://api.github.com/users/shinningstar/orgs","repos_url":"https://api.github.com/users/shinningstar/repos","events_url":"https://api.github.com/users/shinningstar/events{/privacy}","received_events_url":"https://api.github.com/users/shinningstar/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-05T09:01:09Z","updated_at":"2015-06-12T16:41:40Z","closed_at":"2015-06-12T16:41:40Z","body":"The Object interface has a function called Free() which called libgit2 git_object_free(). Some test cases (  https://github.com/libgit2/git2go/blob/master/remote_test.go#L160) are using defer to call Free() function. However, in function allocObject, it has already used SetFinalizer to cal Free() function (https://github.com/libgit2/git2go/blob/master/object.go#L72).\r\nSo, I think the calling defer commit.Free() here is unnecessary, right?\r\n\r\nFurthermore, when should I have to call Free() function explicitly?"}}