From f4ea2a561da9868efc670467061129ac6e53825d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Tue, 15 Jan 2019 20:28:36 +0100 Subject: [PATCH] Keep odb alive when adding mempack --- mempack.go | 1 + 1 file changed, 1 insertion(+) diff --git a/mempack.go b/mempack.go index 72a3df5..337e67d 100644 --- a/mempack.go +++ b/mempack.go @@ -34,6 +34,7 @@ func NewMempack(odb *Odb) (mempack *Mempack, err error) { } ret = C.git_odb_add_backend(odb.ptr, mempack.ptr, C.int(999)) + runtime.KeepAlive(odb) if ret < 0 { // Since git_odb_add_alternate() takes ownership of the ODB backend, the // only case in which we free the mempack's memory is if it fails to be