diff options
author | Vasil Velichkov <vvvelichkov@gmail.com> | 2021-05-12 14:11:15 +0300 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-05-12 11:58:13 +0000 |
commit | b9e942930f6d97006d02194e0e034e95d3a5e60f (patch) | |
tree | 875975e59803920bfe8151277043ae2be0ef3ff0 | |
parent | 5f8612e973807fce72f9ca6d7c68a195f6d38847 (diff) |
maxmin_db: Fix a memory leak in maxmind_db_pop_response
The mmdb_val needs to be allocated with the same wmem allocator as the
one used for mmdb_ipv4_map and mmdb_ipv6_map hash maps.
Build with ENABLE_ASAN and run `ctest -R suite_fileformats -V`
24: Direct leak of 144 byte(s) in 2 object(s) allocated from:
24: #0 0x55e6deb6eebf in malloc (/home/vasko/sources/wireshark/build_clang/run/tshark+0x1f1ebf)
24: #1 0x7f708f717bb8 in g_malloc (/lib64/libglib-2.0.so.0+0x5bbb8)
24: #2 0x7f709c0a7b3c in maxmind_db_pop_response /home/vasko/sources/wireshark/epan/maxmind_db.c:622:49
24: #3 0x7f709c0a895f in maxmind_db_await_response /home/vasko/sources/wireshark/epan/maxmind_db.c:661:9
24: #4 0x7f709c0a895f in maxmind_db_lookup_ipv4 /home/vasko/sources/wireshark/epan/maxmind_db.c:696:17
24: #5 0x7f709d1a97c5 in add_geoip_info_entry /home/vasko/sources/wireshark/epan/dissectors/packet-ip.c:570:33
24: #6 0x7f709d1a2907 in add_geoip_info /home/vasko/sources/wireshark/epan/dissectors/packet-ip.c:662:3
24: #7 0x7f709d1a2907 in dissect_ip_v4 /home/vasko/sources/wireshark/epan/dissectors/packet-ip.c:2205:7
Fixes: v2.9.0rc0-2687-g1bab83de53 ("maxmind: Move response processing to a thread.")
-rw-r--r-- | epan/maxmind_db.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/maxmind_db.c b/epan/maxmind_db.c index 0489605726..17e4373002 100644 --- a/epan/maxmind_db.c +++ b/epan/maxmind_db.c @@ -619,7 +619,7 @@ void maxmind_db_pref_cleanup(void) static void maxmind_db_pop_response(mmdb_response_t *response) { - mmdb_lookup_t *mmdb_val = (mmdb_lookup_t *) g_memdup2(&response->mmdb_val, sizeof(mmdb_lookup_t)); + mmdb_lookup_t *mmdb_val = (mmdb_lookup_t *) wmem_memdup(wmem_epan_scope(), &response->mmdb_val, sizeof(mmdb_lookup_t)); if (response->mmdb_val.country_iso) { char *country_iso = (char *) response->mmdb_val.country_iso; mmdb_val->country_iso = chunkify_string(country_iso); |