ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] [PATCH] Re: Freeing memory of se_alloc'ated object

From: Max <dmitrmax@xxxxxxxxx>
Date: Tue, 3 May 2011 02:28:18 +0400
2011/5/2 Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>:
> Would it be simpler (and more generic) to have a "cleanup"/EOF routine
> similar to the init mechanism but called as soon as we reach (the final) EOF
> (before the se memory is freed)?

May be my C++ experience have corrupted my mind, but I would say no. Not
simpler. You will lack of the context in this mega-super-generic
routine. So you'll
have to create your own mechanism to restore the context for each memory
chunk you want to work with. In this sense, the current situation is pretty much
the same, AFAIK. Look, for example, at the SSL dissector. Thus creating such
mechanism each time you write a dissector is:
1) Reinventing the wheel.
2) Costs you at least the same resources as my solution.

--
Max