VirtualBox

Ignore:
Timestamp:
Jun 23, 2010 8:27:59 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63025
Message:

NAT: fixed RTMemFree condition

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/ip_icmp.c

    r30401 r30404  
    330330{
    331331    register struct icmp *icp;
    332     int fIcpOnMbuf = 1; /* if icp pointer to m->m_data */
     332    void *icp_buf = NULL;
    333333    register struct ip *ip = mtod(m, struct ip *);
    334334    int icmplen = ip->ip_len;
     
    367367    }
    368368
    369     if (m->m_next != NULL)
    370     {
    371         char *buf = RTMemAlloc(icmplen);
    372         if (!buf)
     369    if (m->m_next)
     370    {
     371        icp_buf = RTMemAlloc(icmplen);
     372        if (!icp_buf)
    373373        {
    374374            LogRel(("NAT: not enought memory to allocate the buffer\n"));
    375375            goto end_error;
    376376        }
    377         m_copydata(m, 0, icmplen, buf);
    378         icp = (struct icmp *)buf;
    379         fIcpOnMbuf = 0;
     377        m_copydata(m, 0, icmplen, icp_buf);
     378        icp = (struct icmp *)icp_buf;
    380379    }
    381380    else
    382381        icp = mtod(m, struct icmp *);
    383 
    384382
    385383    m->m_len += hlen;
     
    509507end_error:
    510508    m_freem(pData, m);
     509
    511510done:
    512     if (   !fIcpOnMbuf
    513         && !icp)
    514         RTMemFree(icp);
     511    if (icp_buf)
     512        RTMemFree(icp_buf);
    515513}
    516514
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette