Skip to content

Commit

Permalink
Add runtime.KeepAlive to verifier
Browse files Browse the repository at this point in the history
This is to ensure that the finalizer does not run before verifications
finishes. Closes #55.
  • Loading branch information
oschwald committed May 30, 2019
1 parent 1960b16 commit 2905694
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions verifier.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package maxminddb

import "reflect"
import (
"reflect"
"runtime"
)

type verifier struct {
reader *Reader
Expand All @@ -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 {
Expand Down

0 comments on commit 2905694

Please sign in to comment.