Fix SIGSEGV on double free for Cred object
This change removes the Go finalizer when passing ownership to libgit2. Fixes: #553
This commit is contained in:
commit
0843b826d2
|
@ -255,6 +255,10 @@ func credentialsCallback(_cred **C.git_cred, _url *C.char, _username_from_url *C
|
||||||
}
|
}
|
||||||
if cred != nil {
|
if cred != nil {
|
||||||
*_cred = cred.ptr
|
*_cred = cred.ptr
|
||||||
|
|
||||||
|
// have transferred ownership to libgit, 'forget' the native pointer
|
||||||
|
cred.ptr = nil
|
||||||
|
runtime.SetFinalizer(cred, nil)
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue