mahirziyaokan / iwidarwin

Automatically exported from code.google.com/p/iwidarwin
1 stars 0 forks source link

mbuf_free correctly freeing of mbuf #18

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

jalavoui:
> - mbuf_free - is critical to free the memory

Original issue reported on code.google.com by kazuh...@gmail.com on 11 Feb 2007 at 10:11

GoogleCodeExporter commented 8 years ago

Original comment by kazuh...@gmail.com on 12 Feb 2007 at 12:12

GoogleCodeExporter commented 8 years ago
"mbf" is bad function name ( everybody dont undersntad the meaning ). 

this is named like a  "mbuf_freem_list_with_check".

and "is critical to free the memory" is bad description. 

this should be "added routine to avoid double free."

if u agree me , i merge this after renaming "mbf" to 
"mbuf_freem_list_with_check".

Original comment by kazuh...@gmail.com on 12 Feb 2007 at 7:39

GoogleCodeExporter commented 8 years ago
ok :)

Original comment by jalav...@gmail.com on 13 Feb 2007 at 5:13

GoogleCodeExporter commented 8 years ago
jalavoui, i has one question. 
why do u use not freePacket but mbuf_freem_list ?
i seem that mbuf_freem_list should not be called directly.

void IONetworkController::freePacket(struct mbuf * m, IOOptionBits options)
{
    assert(m);

    if ( options & kDelayFree )
    {
        m->m_nextpkt = _freeList;
        _freeList = m;
    }
    else
    {
        m_freem_list(m);
    }
}

int     mbuf_freem_list(mbuf_t mbuf)
{
        return m_freem_list(mbuf);
}

Original comment by kazuh...@gmail.com on 13 Feb 2007 at 9:50

GoogleCodeExporter commented 8 years ago
i'll try that

Original comment by jalav...@gmail.com on 13 Feb 2007 at 10:33

GoogleCodeExporter commented 8 years ago
at first. 
I will define freePacket_withCheck like a following in mbf.
inline void freePacket_withCheck(mbuf_t m)
{

        if( m != NULL && mbuf_len(m)!=0 && mbuf_type(m)!=MBUF_TYPE_FREE)
            mbuf_freem_list(m);
}

and mbf() -> freePacket_withCheck().

Original comment by kazuh...@gmail.com on 13 Feb 2007 at 11:48

GoogleCodeExporter commented 8 years ago
sorry s/mbuf_free_list/freePacket/

Original comment by kazuh...@gmail.com on 13 Feb 2007 at 11:50

GoogleCodeExporter commented 8 years ago

Original comment by kazuh...@gmail.com on 16 Feb 2007 at 5:02