Fix memleak, free TreeBuilder
This commit is contained in:
parent
d8c3772e35
commit
295ec8894c
|
@ -6,8 +6,8 @@ package git
|
|||
*/
|
||||
import "C"
|
||||
import (
|
||||
"unsafe"
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Repository
|
||||
|
@ -226,7 +226,7 @@ func (repo *Repository) Path() string {
|
|||
return C.GoString(C.git_repository_path(repo.ptr))
|
||||
}
|
||||
|
||||
func (repo *Repository) IsBare() (bool) {
|
||||
func (repo *Repository) IsBare() bool {
|
||||
return C.git_repository_is_bare(repo.ptr) != 0
|
||||
}
|
||||
|
||||
|
@ -249,6 +249,7 @@ func (v *Repository) TreeBuilder() (*TreeBuilder, error) {
|
|||
if ret := C.git_treebuilder_create(&bld.ptr, nil); ret < 0 {
|
||||
return nil, LastError()
|
||||
}
|
||||
runtime.SetFinalizer(bld, (*TreeBuilder).Free)
|
||||
|
||||
bld.repo = v
|
||||
return bld, nil
|
||||
|
|
Loading…
Reference in New Issue