diff options
| author | Carlos Martín Nieto <[email protected]> | 2015-08-13 02:04:23 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2015-08-13 02:04:23 +0200 |
| commit | 3d15c877d8d34c4268a7455bc60129681fa09100 (patch) | |
| tree | 8029b5a664e4370c032115d19c0c2c49b191dfa5 | |
| parent | ed62fda34df271875320f72f36a870b78248ece2 (diff) | |
| parent | 37bb1a6025eac8b1e689686f8830a20a266394cf (diff) | |
Merge pull request #241 from pks-t/memleak-fixes
Memleak fixes
| -rw-r--r-- | branch.go | 6 | ||||
| -rw-r--r-- | merge.go | 1 |
2 files changed, 7 insertions, 0 deletions
@@ -94,6 +94,7 @@ func (repo *Repository) CreateBranch(branchName string, target *Commit, force bo var ptr *C.git_reference cBranchName := C.CString(branchName) + defer C.free(unsafe.Pointer(cBranchName)) cForce := cbool(force) cSignature, err := signature.toC() @@ -134,6 +135,7 @@ func (b *Branch) Delete() error { func (b *Branch) Move(newBranchName string, force bool, signature *Signature, msg string) (*Branch, error) { var ptr *C.git_reference cNewBranchName := C.CString(newBranchName) + defer C.free(unsafe.Pointer(cNewBranchName)) cForce := cbool(force) cSignature, err := signature.toC() @@ -180,6 +182,7 @@ func (repo *Repository) LookupBranch(branchName string, bt BranchType) (*Branch, var ptr *C.git_reference cName := C.CString(branchName) + defer C.free(unsafe.Pointer(cName)) runtime.LockOSThread() defer runtime.UnlockOSThread() @@ -208,6 +211,7 @@ func (b *Branch) Name() (string, error) { func (repo *Repository) RemoteName(canonicalBranchName string) (string, error) { cName := C.CString(canonicalBranchName) + defer C.free(unsafe.Pointer(cName)) nameBuf := C.git_buf{} @@ -225,6 +229,7 @@ func (repo *Repository) RemoteName(canonicalBranchName string) (string, error) { func (b *Branch) SetUpstream(upstreamName string) error { cName := C.CString(upstreamName) + defer C.free(unsafe.Pointer(cName)) runtime.LockOSThread() defer runtime.UnlockOSThread() @@ -251,6 +256,7 @@ func (b *Branch) Upstream() (*Reference, error) { func (repo *Repository) UpstreamName(canonicalBranchName string) (string, error) { cName := C.CString(canonicalBranchName) + defer C.free(unsafe.Pointer(cName)) nameBuf := C.git_buf{} @@ -394,6 +394,7 @@ func MergeFile(ancestor MergeFileInput, ours MergeFileInput, theirs MergeFileInp return nil, MakeGitError(ecode) } populateCMergeFileOptions(copts, *options) + defer freeCMergeFileOptions(copts) } runtime.LockOSThread() |
