diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2018-05-25 19:29:32 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-05-26 05:55:56 +0000 |
commit | 852037fa3caa1348d316d58b60fa584513227b40 (patch) | |
tree | 6c32e6518dd64ee5a35342e994d06fdc4242fe10 /epan/maxmind_db.c | |
parent | 0c64946e04af82334055be8bf6c8962757cd3f8a (diff) |
maxmind_db.c: fix a memory leak
Change-Id: Iee898541ec723cec209a3561899530a8dbe6e680
Reviewed-on: https://code.wireshark.org/review/27809
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/maxmind_db.c')
-rw-r--r-- | epan/maxmind_db.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/maxmind_db.c b/epan/maxmind_db.c index 6cd453e0fc..f4c6314c3d 100644 --- a/epan/maxmind_db.c +++ b/epan/maxmind_db.c @@ -175,9 +175,6 @@ read_mmdbr_stdout(void) { static char cur_addr[WS_INET6_ADDRSTRLEN]; static mmdb_lookup_t cur_lookup; - int read_buf_size = 2048; - char *read_buf = (char *) g_malloc(read_buf_size); - g_mutex_lock(&mmdbr_pipe_mtx); if (!ws_pipe_valid(&mmdbr_pipe)) { g_mutex_unlock(&mmdbr_pipe_mtx); @@ -185,6 +182,9 @@ read_mmdbr_stdout(void) { } MMDB_DEBUG("read mmdbr %d", ws_pipe_data_available(mmdbr_pipe.stdout_fd)); + int read_buf_size = 2048; + char *read_buf = (char *) g_malloc(read_buf_size); + while (ws_pipe_data_available(mmdbr_pipe.stdout_fd)) { read_buf[0] = '\0'; char *line = fgets(read_buf, read_buf_size, mmdbr_stdout); |