Ethereal-dev: Re: [Ethereal-dev] Non-leaking plugins ?

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: Mon, 01 Nov 2004 23:30:53 -0800
Pierre JUHEN wrote:

How to write a non-leaking plugin ?

I suspect functions like proto_item_append_text are creating leaks.

Why? I don't see why it would. The data it allocates should persist as long as the protocol tree to which you've added the tree item isn't freed, but once it's freed all the data allocated by the "proto_tree" routines should be freed. If not, that's a bug, not an intentional feature to be worked around.

Is there a set of rules to build a non leaking plugin, enabling to have a non-leaking tethereal ?

Don't maintain any state.

"Plugin" means "dissector"; the rules here don't differ between plugin dissectors and non-plugin dissectors.