diff options
author | David Perry <boolean263@protonmail.com> | 2021-08-04 13:18:46 -0400 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2021-08-10 00:08:15 +0000 |
commit | 6e12643f198500245ee6eff999804e468481a7b3 (patch) | |
tree | 0d08844a58e4cf465b1d13ecf70a736a5e772105 /tshark.c | |
parent | 4aee4059745f6089e530344289e7ea24d5ec2db4 (diff) |
[#17478] free blocks in more places
Bug 17478 was caused by `wtap_rec.block` being allocated for each
packet, but not freed when it was done being used -- typically at the
end of a loop.
Rather than requiring each caller of `wtap_read()` to know to free a
member of `rec`, I added a new function `wtap_rec_reset()` for a
slightly cleaner API. Added calls to it everywhere that seemed to make
sense.
Fixes #17478
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -2831,6 +2831,7 @@ capture_input_new_packets(capture_session *cap_session, int to_read) /* packet successfully read and gone through the "Read Filter" */ packet_count++; } + wtap_rec_reset(&rec); } epan_dissect_free(edt); @@ -3184,6 +3185,7 @@ process_cap_file_first_pass(capture_file *cf, int max_packet_count, break; } } + wtap_rec_reset(&rec); } if (*err != 0) status = PASS_READ_ERROR; @@ -3413,6 +3415,7 @@ process_cap_file_second_pass(capture_file *cf, wtap_dumper *pdh, } } } + wtap_rec_reset(&rec); } if (edt) @@ -3540,6 +3543,7 @@ process_cap_file_single_pass(capture_file *cf, wtap_dumper *pdh, *err = 0; /* This is not an error */ break; } + wtap_rec_reset(&rec); } if (*err != 0 && status == PASS_SUCCEEDED) { /* Error reading from the input file. */ |