Ethereal-dev: Re: [Ethereal-dev] Regarding Memory allocation

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: Fri, 15 Apr 2005 17:42:31 -0700
harshas wrote:

  I have a problem in display filters. Whenever I apply a display filter
  for the packets say (frame.number >= 12 && frame.number <-=100) I will
  get the filtered packets on the screen but with different packet info.
  The value of the packet info will be different.

Some dissector in Ethereal (whether it's one of the ones that comes with Ethereal or one you've added, perhaps one you've written) is probably doing something such as

	if (tree) {
		...
		if (check_col(pinfo->cinfo, COL_INFO))
			col_add_fstr(pinfo->cinfo, COL_INFO, ...);
		...
	}

The "col_add_", "col_set", and "col_append" calls should *NEVER* be called inside an "if (tree)" or "if (tree != NULL)" test - they should be called *regardless* of whether the "tree" argument is null or not.

In addition, any routines that call those "col_" routines and that are called by the main dissector routine should be called regardless of whether the "tree" argument is null or not.