aboutsummaryrefslogtreecommitdiffstats
path: root/reordercap.c
diff options
context:
space:
mode:
authorDavid Perry <boolean263@protonmail.com>2021-08-04 13:18:46 -0400
committerGuy Harris <gharris@sonic.net>2021-08-10 00:08:15 +0000
commit6e12643f198500245ee6eff999804e468481a7b3 (patch)
tree0d08844a58e4cf465b1d13ecf70a736a5e772105 /reordercap.c
parent4aee4059745f6089e530344289e7ea24d5ec2db4 (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 'reordercap.c')
-rw-r--r--reordercap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/reordercap.c b/reordercap.c
index 643732c255..c8aa70297b 100644
--- a/reordercap.c
+++ b/reordercap.c
@@ -122,6 +122,7 @@ frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh,
wtap_file_type_subtype(wth));
exit(1);
}
+ wtap_rec_reset(rec);
}
/* Comparing timestamps between 2 frames.
@@ -328,6 +329,7 @@ main(int argc, char *argv[])
g_ptr_array_add(frames, newFrameRecord);
prevFrame = newFrameRecord;
+ wtap_rec_reset(&rec);
}
wtap_rec_cleanup(&rec);
ws_buffer_free(&buf);