diff --git a/cmd/geo/cmd_check.go b/cmd/geo/cmd_check.go index 83313dd..5aa9a4d 100644 --- a/cmd/geo/cmd_check.go +++ b/cmd/geo/cmd_check.go @@ -73,6 +73,7 @@ func check(cmd *cobra.Command, args []string) error { fmt.Println("❌Failed to verify GeoIP database!") fmt.Println("Error:", err) } + mmdb.Close() if mmdb.Metadata.Description["PLACEHOLDER"] == "geo" { mmdb.Metadata.Description = nil } diff --git a/cmd/geo/cmd_look.go b/cmd/geo/cmd_look.go index 3be1f63..9fad923 100644 --- a/cmd/geo/cmd_look.go +++ b/cmd/geo/cmd_look.go @@ -124,6 +124,7 @@ func look(cmd *cobra.Command, args []string) error { } codes := db.LookupCode(ip) + db.Close() for _, code := range codes { result[strings.ToUpper(code)] = struct{}{} } diff --git a/geoip/geoip.go b/geoip/geoip.go index 2654f35..fa21c54 100644 --- a/geoip/geoip.go +++ b/geoip/geoip.go @@ -54,3 +54,7 @@ func (db Database) LookupCode(ip net.IP) []string { panic(F.ToString("unknown GeoIP database type: ", string(db.MemoryType))) } } + +func (db Database) Close() error { + return db.reader.Close() +}