Wireshark-bugs: [Wireshark-bugs] [Bug 4141] New: Reassemble.c leaks memory for GLIB > 2.8
Date: Mon, 19 Oct 2009 17:54:51 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4141

           Summary: Reassemble.c leaks memory for GLIB > 2.8
           Product: Wireshark
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Medium
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: wmeier@xxxxxxxxxxx


Build Information:
.
--
> It appears that there are one or two related memory leaks 
> associated with reloading a file and having to do with defragmentation 
> in reassemble.c
> 
>    Basically: during fragment_table_init & reassembled_table_init:
>    a. fragment_data structs in the "fd lists" pointed to from the
>       fragment_tables and reassembled_tables hashes are not freed;
>    b. fragment_key structs pointed to from the fragment_tables hash are
>       not freed.
> 
>    The code using GMemChunks freed these structs in reassemble_cleanup
>    using g_mem_chunk_destroy.
>    This hasn't worked since GLib 2.10 when g_mem_chunk_destroy stopped
>    actually freeing memory.
> 
>    (Using g_slice doesn't change things since the code assumes that
>    the structs can be but need not be freed individually).
> 
>    The lossage: mostly fragment_data_structs:
>        32-bytes * number_of_fragments_in_a_capture.
> 
>    Using se_alloc for these structs isn't the right answer
>    because currently se_free_all is being called *before* the loop
>    through all the dissector "registered init" fcns.
>    (Also: fragment_key structs sometimes are individually freed).
> 
> 
>    I'm leaning towards the following:
>       Free the fragment_data structs and etc in fragment_table_init
>       and reassembled_table_init (similar to fragment_delete).
>       (One has to be careful about doing so
>       for the reassembled_table since an fd-chain can/will appear
>       multiple times in the reassembled hash).
>       Also note that currently for free_all_reassembled_fragments()
>       that the 'key_arg' points to se_alloc'd memory which has already
>       been freed.


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.