From 067989fe994dd9d33a4b38e42f194e51e0f3438c Mon Sep 17 00:00:00 2001 From: Michael Boulton Date: Mon, 17 Aug 2020 08:05:44 +0100 Subject: [PATCH] Fix some missing keepalives --- diff.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/diff.go b/diff.go index 1412ca9..2bd3cf0 100644 --- a/diff.go +++ b/diff.go @@ -957,8 +957,11 @@ func (v *Repository) ApplyDiff(diff *Diff, location GitApplyLocation, opts *Appl runtime.LockOSThread() defer runtime.UnlockOSThread() - ecode := C.git_apply(v.ptr, diff.ptr, C.git_apply_location_t(location), opts.toC()) + cOpts := opts.toC() + ecode := C.git_apply(v.ptr, diff.ptr, C.git_apply_location_t(location), cOpts) runtime.KeepAlive(v) + runtime.KeepAlive(diff) + runtime.KeepAlive(cOpts) if ecode < 0 { return MakeGitError(ecode) }