summaryrefslogtreecommitdiff
path: root/patch.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2017-07-08 16:51:22 +0200
committerGitHub <[email protected]>2017-07-08 16:51:22 +0200
commit08db2e2c167404c5ed9be0fc1c995e41bad479bb (patch)
tree4a9c1357f3682d4134318e73ef85aa172cbfbd48 /patch.go
parent29c0b730076fe402c22ea3e3a11a7ed541663637 (diff)
parent55a1096141519a1f380d0702671cfe9bf90ec435 (diff)
Merge pull request #393 from libgit2/cmn/keepalive-all-the-things
KeepAlive all the things
Diffstat (limited to 'patch.go')
-rw-r--r--patch.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/patch.go b/patch.go
index 0d0df7f..75e843c 100644
--- a/patch.go
+++ b/patch.go
@@ -47,6 +47,7 @@ func (patch *Patch) String() (string, error) {
var buf C.git_buf
ecode := C.git_patch_to_buf(&buf, patch.ptr)
+ runtime.KeepAlive(patch)
if ecode < 0 {
return "", MakeGitError(ecode)
}
@@ -83,6 +84,8 @@ func (v *Repository) PatchFromBuffers(oldPath, newPath string, oldBuf, newBuf []
defer runtime.UnlockOSThread()
ecode := C.git_patch_from_buffers(&patchPtr, oldPtr, C.size_t(len(oldBuf)), cOldPath, newPtr, C.size_t(len(newBuf)), cNewPath, copts)
+ runtime.KeepAlive(oldBuf)
+ runtime.KeepAlive(newBuf)
if ecode < 0 {
return nil, MakeGitError(ecode)
}