geoip: Fix memory leak when using GeoIPRecord
commit8fd19eefa46b313673d6ba2a0194a68674ef5ea9
authorVadim Kochan <vadim4j@gmail.com>
Sat, 4 Feb 2017 09:56:14 +0000 (4 11:56 +0200)
committerTobias Klauser <tklauser@distanz.ch>
Mon, 6 Feb 2017 16:26:28 +0000 (6 17:26 +0100)
tree569da73381afb80fe8eb70d1183fbac0339da4ef
parent1e1383fea55fb35cec96a352da93c2a31d9e897c
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>
astraceroute.c
flowtop.c
geoip.c
geoip.h
proto_ipv4.c
proto_ipv6.c