VirtualBox

Ignore:
Timestamp:
Jun 21, 2022 2:42:41 PM (3 years ago)
Author:
vboxsync
Message:

GA/pam_vbox.cpp: Fixed leak in pam_vbox_wait_prop.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/pam/pam_vbox.cpp

    r95327 r95328  
    503503    uint32_t cbBuf = GUEST_PROP_MAX_NAME_LEN + GUEST_PROP_MAX_VALUE_LEN + GUEST_PROP_MAX_FLAGS_LEN + _1K;
    504504
    505     for (int i = 0; i < 10; i++)
     505    for (int i = 0; ; i++)
    506506    {
    507507        void *pvTmpBuf = RTMemRealloc(pvBuf, cbBuf);
     
    518518                                     &pszName, &pszValue, &u64TimestampOut,
    519519                                     &pszFlags, &cbBuf, NULL /* pfWasDeleted */);
     520            if (rc == VERR_BUFFER_OVERFLOW && i < 10)
     521            {
     522                cbBuf += _1K; /* Buffer too small, try it with a bigger one more time. */
     523                continue;
     524            }
    520525        }
    521526        else
    522527            rc = VERR_NO_MEMORY;
    523 
    524         if (rc == VERR_BUFFER_OVERFLOW)
    525         {
    526             /* Buffer too small, try it with a bigger one next time. */
    527             cbBuf += _1K;
    528             continue; /* Try next round. */
    529         }
    530 
    531         /* Everything except VERR_BUFFER_OVERLOW makes us bail out ... */
    532528        break;
    533529    }
    534530
     531    RTMemFree(pvBuf);
    535532    return rc;
    536533}
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