From deac4d867e3768a0516dd4c2b32cadb59352911e Mon Sep 17 00:00:00 2001 From: Steven Tracey Date: Thu, 21 Nov 2024 17:17:11 -0500 Subject: [PATCH] Staying alive ah ah ah ah --- go/totp.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go/totp.go b/go/totp.go index 9fe3407..868b660 100644 --- a/go/totp.go +++ b/go/totp.go @@ -139,7 +139,10 @@ func getConfigNames() (**C.char, C.int) { cStrings[i] = C.CString(name) } - return (**C.char)(unsafe.Pointer(&cStrings[0])), C.int(len(names)) + cArray := (**C.char)(unsafe.Pointer(&cStrings[0])) + runtime.KeepAlive(cArray) + + return cArray, C.int(len(names)) } //export getCode