From 2905694a1b00c5574f1418a7dbf8a22a7d247559 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 29 May 2019 18:51:12 -0700 Subject: [PATCH] Add runtime.KeepAlive to verifier This is to ensure that the finalizer does not run before verifications finishes. Closes #55. --- verifier.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/verifier.go b/verifier.go index ace9d35..45d25c8 100644 --- a/verifier.go +++ b/verifier.go @@ -1,6 +1,9 @@ package maxminddb -import "reflect" +import ( + "reflect" + "runtime" +) type verifier struct { reader *Reader @@ -15,7 +18,9 @@ func (r *Reader) Verify() error { return err } - return v.verifyDatabase() + err := v.verifyDatabase() + runtime.KeepAlive(v.reader) + return err } func (v *verifier) verifyMetadata() error {