diff options
| author | FUJII Ryota <[email protected]> | 2015-12-16 16:37:50 +0900 |
|---|---|---|
| committer | FUJII Ryota <[email protected]> | 2015-12-16 16:43:26 +0900 |
| commit | 1cdf1d70a2c08b1b87611be11cb448075ea45f2b (patch) | |
| tree | 2a83e8b5b44ef5dcf17cca60232f8153168a43dc /index.go | |
| parent | 749963ce55c6391bf7222057b037344a0cb837cf (diff) | |
Fix a memory leak in Index.EntryByPath()
Diffstat (limited to 'index.go')
| -rw-r--r-- | index.go | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -350,10 +350,13 @@ func (v *Index) EntryByIndex(index uint) (*IndexEntry, error) { } func (v *Index) EntryByPath(path string, stage int) (*IndexEntry, error) { + cpath := C.CString(path) + defer C.free(unsafe.Pointer(cpath)) + runtime.LockOSThread() defer runtime.UnlockOSThread() - centry := C.git_index_get_bypath(v.ptr, C.CString(path), C.int(stage)) + centry := C.git_index_get_bypath(v.ptr, cpath, C.int(stage)) if centry == nil { return nil, MakeGitError(C.GIT_ENOTFOUND) } |
