summaryrefslogtreecommitdiff
path: root/geoip.h
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2017-02-04 11:56:14 +0200
committerTobias Klauser <tklauser@distanz.ch>2017-02-06 17:26:28 +0100
commit8fd19eefa46b313673d6ba2a0194a68674ef5ea9 (patch)
tree569da73381afb80fe8eb70d1183fbac0339da4ef /geoip.h
parent1e1383fea55fb35cec96a352da93c2a31d9e897c (diff)
geoip: Fix memory leak when using GeoIPRecord
GeoIP_record_by_ipnum{,_v6} returns allocated pointer to GeoIPRecord with allocated city, region & postal_code which is not freed after the call. Fixed by xstrdup-ing required GeoIPRecord member (city/region) and after calling GeoIPRecord_delete to free the geoip record. Of course it is needed to also free obtained city/region in netsniff-ng, astraceroute & flowtop tools. Fixes #169 Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'geoip.h')
-rw-r--r--geoip.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/geoip.h b/geoip.h
index 5d5c221..cdeef19 100644
--- a/geoip.h
+++ b/geoip.h
@@ -11,10 +11,10 @@
extern void init_geoip(int enforce);
extern void update_geoip(void);
extern int geoip_working(void);
-extern const char *geoip4_city_name(struct sockaddr_in *sa);
-extern const char *geoip6_city_name(struct sockaddr_in6 *sa);
-extern const char *geoip4_region_name(struct sockaddr_in *sa);
-extern const char *geoip6_region_name(struct sockaddr_in6 *sa);
+extern char *geoip4_city_name(struct sockaddr_in *sa);
+extern char *geoip6_city_name(struct sockaddr_in6 *sa);
+extern char *geoip4_region_name(struct sockaddr_in *sa);
+extern char *geoip6_region_name(struct sockaddr_in6 *sa);
extern const char *geoip4_country_name(struct sockaddr_in *sa);
extern const char *geoip6_country_name(struct sockaddr_in6 *sa);
extern const char *geoip4_country_code3_name(struct sockaddr_in *sa);