On Aug 27, 2012, at 5:58 PM, Dirk Jagdmann wrote:
> is there a way to register a cleanup function in a dissector to be called
> when a file closed? I have a couple of hash tables allocated using
> g_hash_table_new() that I want to free when the user closes the file.
Literally speaking, not at present. However, you can register a routine to be
called when a file is *opened*, and have that routine free up any old stuff, if
any, remaining from a previous capture. See register_init_routine().
Arguably, there should be separate "initialize" and "finish" routines.
In addition, as Joerg noted, for some purposes you might want to use
Wireshark's memory-chunk allocators and allocate "seasonal" memory ("seasons"
begin when a capture is opened and end when a capture is closed).
___________________________________________________________________________
Sent via: Wireshark-dev mailing list <[email protected]>
Archives: http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
mailto:[email protected]?subject=unsubscribe