VirtualBox

Changeset 38101 in vbox


Ignore:
Timestamp:
Jul 21, 2011 2:16:20 PM (13 years ago)
Author:
vboxsync
Message:

NAT: fixed error path

File:
1 edited

Legend:

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

    r38090 r38101  
    588588    int fNATfailed = 0;
    589589    int rc;
    590     PNATState pData = RTMemAllocZ(RT_ALIGN_Z(sizeof(NATState), sizeof(uint64_t)));
     590    PNATState pData;
     591    if (u32Netmask & 0x1f)
     592        /* CTL is x.x.x.15, bootp passes up to 16 IPs (15..31) */
     593        return VERR_INVALID_PARAMETER;
     594    pData = RTMemAllocZ(RT_ALIGN_Z(sizeof(NATState), sizeof(uint64_t)));
    591595    *ppData = pData;
    592596    if (!pData)
    593597        return VERR_NO_MEMORY;
    594     if (u32Netmask & 0x1f)
    595         /* CTL is x.x.x.15, bootp passes up to 16 IPs (15..31) */
    596         return VERR_INVALID_PARAMETER;
    597598    pData->fPassDomain = !fUseHostResolver ? fPassDomain : false;
    598599    pData->fUseHostResolver = fUseHostResolver;
     
    623624
    624625    rc = bootp_dhcp_init(pData);
    625     if (rc != 0)
    626     {
    627         Log(("NAT: DHCP server initialization was failed\n"));
    628         return VINF_NAT_DNS;
     626    if (RT_FAILURE(rc))
     627    {
     628        Log(("NAT: DHCP server initialization failed\n"));
     629        RTMemFree(pData);
     630        *ppData = NULL;
     631        return rc;
    629632    }
    630633    debug_init();
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