Wireshark-dev: Re: [Wireshark-dev] COPY_ADDRESS and g_malloc()
Date: Tue, 14 Nov 2006 09:47:16 +0100
Hello, If you modify the COPY_ADDRESS, could you have a look at this bug ? http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1113 As the conversation structure has been se_allocated, it is not possible to free the data "key->addr1.data", because the structure was released by "se_free_all". So the change of COPY_ADDRESS has probably some impacts, for dissectors wanting to free the data itself. Maybe, there is a lot of work behind this change ? But anyway this is a good idea to remove the g_malloc() and to clarify the use of COPY_ADDRESS. Best regards Florent << conversation_init(void) { conversation_key *key; ../.. for (key = conversation_keys; key != NULL; key = key->next) { /* * Grr. I guess the theory here is that freeing * something sure as heck modifies it, so you * want to ban attempts to free it, but, alas, * if we make the "data" field of an "address" * structure not a "const", the compiler whines if * we try to make it point into the data for a packet, * as that's a "const" array (and should be, as dissectors * shouldn't trash it). * * So we cast the complaint into oblivion, and rely on * the fact that these addresses are known to have had * their data mallocated, i.e. they don't point into, * say, the middle of the data for a packet. */ g_free((gpointer)key->addr1.data); g_free((gpointer)key->addr2.data); } >> LEGO <luis.ontanon@xxxxxxxxx> To: "Developer support list for Wireshark" Sent by: <wireshark-dev@xxxxxxxxxxxxx> wireshark-dev-bounces@wi cc: reshark.org Subject: Re: [Wireshark-dev] COPY_ADDRESS and g_malloc() 13/11/2006 12:46 Please respond to Developer support list for Wireshark There is another issue, currently COPY_ADDRESS is to be given a pointer to the address structure to be populated, whose lifetime might be whatever (stack, se-heap, ep-heap, pe-heap) and not linked to whatever populates the structure. I believe that we should have two sets of COPY_ADDRESS one that returns a newly allocated and populated address struct (XX_DUP_ADDRESS), and another that does what it's currently being done (XX_COPY_ADDRESS). Luis On 11/13/06, Kukosa, Tomas <tomas.kukosa@xxxxxxxxxxx> wrote: > I have got the same idea meantime. > > T. > > -----Original Message----- > From: wireshark-dev-bounces@xxxxxxxxxxxxx > [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of LEGO > Sent: Monday, November 13, 2006 12:33 PM > To: Developer support list for Wireshark > Subject: Re: [Wireshark-dev] COPY_ADDRESS and g_malloc() > > may be we should have EP_COPY_ADDRESS, SE_COPY_ADDRESS and > PE_COPY_ADDRESS instead. > > > On 11/13/06, Kukosa, Tomas <tomas.kukosa@xxxxxxxxxxx> wrote: > > > > Hi, > > > > does not it make sence to change g_malloc() in COPY_ADDRESS to > > se_alloc() ? > > It seems that it is not freed in most cases of usage. > > Do wee need anywhere longer lifetime then se_alloc() has? > > > > Tomas > > > > > > > > _______________________________________________ > > Wireshark-dev mailing list > > Wireshark-dev@xxxxxxxxxxxxx > > http://www.wireshark.org/mailman/listinfo/wireshark-dev > > > > > -- > This information is top security. When you have read it, destroy > yourself. > -- Marshall McLuhan > _______________________________________________ > Wireshark-dev mailing list > Wireshark-dev@xxxxxxxxxxxxx > http://www.wireshark.org/mailman/listinfo/wireshark-dev > _______________________________________________ > Wireshark-dev mailing list > Wireshark-dev@xxxxxxxxxxxxx > http://www.wireshark.org/mailman/listinfo/wireshark-dev > -- This information is top security. When you have read it, destroy yourself. -- Marshall McLuhan _______________________________________________ Wireshark-dev mailing list Wireshark-dev@xxxxxxxxxxxxx http://www.wireshark.org/mailman/listinfo/wireshark-dev
- References:
- Prev by Date: Re: [Wireshark-dev] Continuing support for ucd-snmp?
- Next by Date: [Wireshark-dev] Need help on Reassembly and building ethereal on windows.
- Previous by thread: Re: [Wireshark-dev] COPY_ADDRESS and g_malloc()
- Next by thread: [Wireshark-dev] [PATCH] DCCP: variable-length checksums
- Index(es):