diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-06-24 01:54:19 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-07-03 23:10:22 +0000 |
commit | d52837d10dd63827acb6f42af7f32ca82fb1fe21 (patch) | |
tree | 0a16917ecfa97274673da41fb2ade214fbf784d0 /epan/packet.h | |
parent | fdb85029fd9b22b221f7123905f1bad66c04ce91 (diff) | |
download | wireshark-d52837d10dd63827acb6f42af7f32ca82fb1fe21.tar.gz |
packet: add cleanup routines support
Currently reassembly tables are not freed on shutdown. This makes
memleak debugging more difficult due to noise. Support cleanup
routines that can do smarter things.
After this change, "init" routines are not called anymore when
closing files. Further changes should split init routines to
cleanup routines as needed.
Change-Id: Ib0b2cef6dd9c16905259063ac2c2fdfb7e066be6
Reviewed-on: https://code.wireshark.org/review/9135
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/packet.h')
-rw-r--r-- | epan/packet.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/epan/packet.h b/epan/packet.h index 846567e5ba..318c69eb01 100644 --- a/epan/packet.h +++ b/epan/packet.h @@ -563,12 +563,24 @@ extern void dissect_cleanup(void); */ WS_DLL_PUBLIC void set_actual_length(tvbuff_t *tvb, const guint specified_len); -/* Allow protocols to register "init" routines, which are called before - we make a pass through a capture file and dissect all its packets - (e.g., when we read in a new capture file, or run a "filter packets" - or "colorize packets" pass over the current capture file). */ +/** + * Allow protocols to register "init" routines, which are called before + * we make a pass through a capture file and dissect all its packets + * (e.g., when we read in a new capture file, or run a "filter packets" + * or "colorize packets" pass over the current capture file or when the + * preferences are changed). + */ WS_DLL_PUBLIC void register_init_routine(void (*func)(void)); +/** + * Allows protocols to register "cleanup" routines which are called + * after closing a capture file (or when preferences are changed, in + * that case these routines are called before the init routines are + * executed). It can be used to release resources that are allocated in + * register_init_routine. + */ +WS_DLL_PUBLIC void register_cleanup_routine(void (*func)(void)); + /* Initialize all data structures used for dissection. */ void init_dissection(void); |