VirtualBox

Changeset 51918 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Jul 8, 2014 3:15:24 AM (11 years ago)
Author:
vboxsync
Message:

SUPDrv-win.cpp: Memory leak. Allocation adjustments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r51907 r51918  
    22272227     * Note! Attempts at using SystemSessionProcessInformation failed with
    22282228     *       STATUS_ACCESS_VIOLATION.
     2229     * Note! The 32 bytes on the size of to counteract the allocation header
     2230     *       that rtR0MemAllocEx slaps on everything.
    22292231     */
    2230     ULONG       cbNeeded = _64K;
     2232    ULONG       cbNeeded = _64K - 32;
    22312233    uint32_t    cbBuf;
    22322234    uint8_t    *pbBuf = NULL;
    22332235    do
    22342236    {
    2235         cbBuf = RT_ALIGN(cbNeeded + _4K, _64K);
     2237        cbBuf = RT_ALIGN(cbNeeded + _4K, _64K) - 32;
    22362238        pbBuf = (uint8_t *)RTMemAlloc(cbBuf);
    22372239        if (!pbBuf)
     
    32963298    /*
    32973299     * Take a snapshot of all the handles in the system.
     3300     * Note! The 32 bytes on the size of to counteract the allocation header
     3301     *       that rtR0MemAllocEx slaps on everything.
    32983302     */
    3299     uint32_t    cbBuf    = _256K;
     3303    uint32_t    cbBuf    = _256K - 32;
    33003304    uint8_t    *pbBuf    = (uint8_t *)RTMemAlloc(cbBuf);
    33013305    ULONG       cbNeeded = cbBuf;
     
    33073311               && cbBuf <= 32U*_1M)
    33083312        {
    3309             cbBuf = RT_ALIGN_32(cbNeeded + _4K, _64K);
     3313            cbBuf = RT_ALIGN_32(cbNeeded + _4K, _64K) - 32;
    33103314            RTMemFree(pbBuf);
    33113315            pbBuf = (uint8_t *)RTMemAlloc(cbBuf);
     
    34143418    }
    34153419
     3420    RTMemFree(pbBuf);
    34163421    return rc;
    34173422}
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