Ethereal-dev: RE: [ethereal-dev] problem with 'live' captures and latest CVS.

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

From: "Paul Wagland" <pwagland@xxxxxxxxxxx>
Date: Mon, 3 Apr 2000 17:51:31 +0200
Hi Gilbert,

Line 666 for me is the same as for you.
ie:

> That's interesting. What is on line 666 of your file.c? On mine, it's
>
>   fdata->next = NULL;

Yes, I had assumed that fdata was NULL, but have not yet looked at the
situation to actually work out what was going on. I don't still have the
core, but this problem is easily reproducible for me.... :-)

There, just generated another one....Yep, fdata is NULL.

Now, why is fdata NULL? Obviously g_mem_chunk_alloc(cf->plist_chunk) failed,
but why.  Further looking indicates that cf is valid, but cf->plist_chunk
probably is not. cf->plist_chunk is currently 0, normally a malloc of 0
returns NULL. so g_mem_chunk_alloc is probably doing the right thing.

The solution then (?) is to either a) give cf->plist_chunk the correct
value, or b) not allocate (or use! :-) the memory if cf->plist_chunk == 0 is
valid....

--hope this helps?
Paul

here is the debug from gdb just in case it helps...

(gdb) print fdata
$1 = (frame_data *) 0x0
(gdb) print cf
$2 = {fh = 0x81f22e8, filed = 8, filename = 0x81f22c8
"/tmp/etherXXXXOnzwml",
  is_tempfile = 1, user_saved = 0, f_len = 24, cd_t = 2, lnk_t = 0, vers =
0,
  count = 0, drops = 0, esec = 0, eusec = 0, snap = 65535, update_progbar =
0,
  progbar_quantum = 0, progbar_nextstep = 0, iface = 0x81f7bc8 "eth0",
  save_file = 0x81f56d8 "/tmp/etherXXXXOnzwml", save_file_fd = 6,
  wth = 0x81f5030, rfcode = 0x0, dfilter = 0x0, colors = 0x81ef9a8,
  dfcode = 0x0, cfilter = 0x81aab00 "", fcode = {bf_len = 0, bf_insns =
0x0},
  sfilter = 0x0, sbackward = 0, pd = '\000' <repeats 65534 times>,
  plist_chunk = 0x0, plist = 0x0, plist_end = 0x0, first_displayed = 0x0,
  last_displayed = 0x0, cinfo = {num_cols = 6, col_fmt = 0x81aab10,
    fmt_matx = 0x81aab30, col_width = 0x81aab50, col_title = 0x81aab70,
    col_data = 0x81aab90}, current_frame = 0x0, current_row = 0,
  current_frame_is_selected = 0, protocol_tree = 0x0, print_fh = 0x0}




> -----Original Message-----
> From: owner-ethereal-dev@xxxxxxxx [mailto:owner-ethereal-dev@xxxxxxxx]On
> Behalf Of Gilbert Ramirez
>
> Which is the first thing after allocating a frame_data. A few
> days ago we did
> this:
>
>   /* Allocate the next list entry, and add it to the list. */
>   fdata = (frame_data *) g_malloc(sizeof(frame_data));
>
> But now we do this:
>
> /* Allocate the next list entry, and add it to the list. */
>   fdata = g_mem_chunk_alloc(cf->plist_chunk);
>
> It would appear that g_malloc returned a bad value. It probably
> returned NULL to indicate "out of memory".
> --gilbert
>