VirtualBox

Changeset 75008 in vbox for trunk/include/iprt/cpp


Ignore:
Timestamp:
Oct 23, 2018 4:08:44 PM (6 years ago)
Author:
vboxsync
Message:

IPRT/RTCString: reserve(1) called on an empty string must allocate memory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cpp/ministring.h

    r74262 r75008  
    244244    void reserve(size_t cb)
    245245    {
    246         if (    cb != m_cbAllocated
    247              && cb > m_cch + 1
    248            )
     246        if (   (   cb != m_cbAllocated
     247                && cb > m_cch + 1)
     248            || (   m_psz == NULL
     249                && cb > 0))
    249250        {
    250251            int rc = RTStrRealloc(&m_psz, cb);
     
    266267    int reserveNoThrow(size_t cb) RT_NOEXCEPT
    267268    {
    268         if (    cb != m_cbAllocated
    269              && cb > m_cch + 1
    270            )
     269        if (   (   cb != m_cbAllocated
     270                && cb > m_cch + 1)
     271            || (   m_psz == NULL
     272                && cb > 0))
    271273        {
    272274            int rc = RTStrRealloc(&m_psz, cb);
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