VirtualBox

Changeset 23909 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 20, 2009 3:50:06 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53711
Message:

Main: fix tiny memory leak in GetExtraData

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r23882 r23909  
    27432743
    27442744    /* start with nothing found */
    2745     Bstr("").cloneTo(aValue);
     2745    Utf8Str strResult;
    27462746
    27472747    AutoReadLock alock (this);
     
    27492749    settings::ExtraDataItemsMap::const_iterator it = mData->m_pMachineConfigFile->mapExtraDataItems.find(Utf8Str(aKey));
    27502750    if (it != mData->m_pMachineConfigFile->mapExtraDataItems.end())
    2751     {
    27522751        // found:
    2753         const Utf8Str &strValue = it->second;
    2754         strValue.cloneTo(aValue);
    2755     }
     2752        strResult = it->second;
     2753
     2754    /* return the result to caller (may be empty) */
     2755    strResult.cloneTo(aValue);
    27562756
    27572757    return S_OK;
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r23327 r23909  
    16071607
    16081608    /* start with nothing found */
    1609     Bstr("").cloneTo(aValue);
     1609    Utf8Str strResult;
    16101610
    16111611    settings::ExtraDataItemsMap::const_iterator it = m->pMainConfigFile->mapExtraDataItems.find(Utf8Str(aKey));
    16121612    if (it != m->pMainConfigFile->mapExtraDataItems.end())
    1613     {
    16141613        // found:
    1615         const Utf8Str &strValue = it->second;
    1616         strValue.cloneTo(aValue);
    1617     }
     1614        strResult = it->second;
     1615
     1616    /* return the result to caller (may be empty) */
     1617    strResult.cloneTo(aValue);
    16181618
    16191619    return S_OK;
Note: See TracChangeset for help on using the changeset viewer.

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