summaryrefslogtreecommitdiff
path: root/src/char/geoip.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-17 22:36:52 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-18 01:47:52 +0300
commit1ea16746b1330656e152278a7192e5b7adef0539 (patch)
treeba39cd973386265febe75fbe831e161d0355b02b /src/char/geoip.c
parentf0ea100d5ccc03d8f94b67ea9d3ffa82fcd937b1 (diff)
downloadhercules-1ea16746b1330656e152278a7192e5b7adef0539.tar.gz
hercules-1ea16746b1330656e152278a7192e5b7adef0539.tar.bz2
hercules-1ea16746b1330656e152278a7192e5b7adef0539.tar.xz
hercules-1ea16746b1330656e152278a7192e5b7adef0539.zip
Add some fixes to char server.
Found by coverity scan.
Diffstat (limited to 'src/char/geoip.c')
-rw-r--r--src/char/geoip.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/char/geoip.c b/src/char/geoip.c
index 4fe03ab07..e5b77af1f 100644
--- a/src/char/geoip.c
+++ b/src/char/geoip.c
@@ -78,7 +78,7 @@ const char* geoip_getcountry(uint32 ipnum)
if (x >= GEOIP_COUNTRY_BEGIN) {
x = x-GEOIP_COUNTRY_BEGIN;
- if( x > GEOIP_MAX_COUNTRIES )
+ if( x >= GEOIP_MAX_COUNTRIES )
return geoip_countryname[0];
return geoip_countryname[x];
@@ -133,6 +133,7 @@ void geoip_init(void)
fno = fileno(db);
if (fstat(fno, &bufa) < 0) {
ShowError("geoip_readdb: Error stating GeoIP.dat! Error %d\n", errno);
+ fclose(db);
geoip->final(false);
return;
}