Ethereal-dev: Re: [Ethereal-dev] new dissector - packet-baby.[ch]

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Tue, 28 Aug 2001 00:23:03 -0700
On Mon, Aug 20, 2001 at 02:18:17AM -0700, Guy Harris wrote:
> I also checked in a change to free up the exception ID string if one was
> allocated; it needs some additional work - you need to catch exceptions,
> so that if a dissector throws an exception, we still free the string,
> and then the exception has to be rethrown.
> 
> Either that or we need to add a cleanup callback to free the string -
> and any *other* dynamically-allocated data....

I've checked in a change that moves a bunch of "g_free()" calls as close
as possible to the allocation, which, if there are no tvbuff references
between the allocation and the free, obviates the need for a cleanup
callback.  (I found the calls by auditing the code, which also found
some places where there *were* no "g_free()" calls, and one place where
the allocations were happening in a loop but the free was happening
outside the loop.)

In the remaining cases, where there had to be tvbuff references between
the allocation and the freeing, I added cleanup callbacks.