VirtualBox

Changeset 56748 in vbox


Ignore:
Timestamp:
Jul 2, 2015 11:31:34 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
101394
Message:

Storage/VD: Fix three possible memory leaks (unlikely to hit) in case the realloc returns with pTmp \!= g_ahBackendPlugins and friends

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/VD.cpp

    r55271 r56748  
    676676    if (RT_UNLIKELY(!pTmp))
    677677        return VERR_NO_MEMORY;
     678    g_apBackends = pTmp;
     679
    678680    RTLDRMOD *pTmpPlugins = (RTLDRMOD*)RTMemRealloc(g_ahBackendPlugins,
    679681           (g_cBackends + cBackends) * sizeof(RTLDRMOD));
    680682    if (RT_UNLIKELY(!pTmpPlugins))
    681683        return VERR_NO_MEMORY;
    682     g_apBackends = pTmp;
    683684    g_ahBackendPlugins = pTmpPlugins;
    684685    memcpy(&g_apBackends[g_cBackends], ppBackends, cBackends * sizeof(PCVBOXHDDBACKEND));
     
    706707    if (RT_UNLIKELY(!pTmp))
    707708        return VERR_NO_MEMORY;
     709    g_apCacheBackends = pTmp;
     710
    708711    RTLDRMOD *pTmpPlugins = (RTLDRMOD*)RTMemRealloc(g_ahCacheBackendPlugins,
    709712           (g_cCacheBackends + cBackends) * sizeof(RTLDRMOD));
    710713    if (RT_UNLIKELY(!pTmpPlugins))
    711714        return VERR_NO_MEMORY;
    712     g_apCacheBackends = pTmp;
    713715    g_ahCacheBackendPlugins = pTmpPlugins;
    714716    memcpy(&g_apCacheBackends[g_cCacheBackends], ppBackends, cBackends * sizeof(PCVDCACHEBACKEND));
     
    741743    if (RT_UNLIKELY(!pTmp))
    742744        return VERR_NO_MEMORY;
     745    g_apFilterBackends = pTmp;
     746
    743747    RTLDRMOD *pTmpPlugins = (RTLDRMOD*)RTMemRealloc(g_ahFilterBackendPlugins,
    744748           (g_cFilterBackends + cBackends) * sizeof(RTLDRMOD));
    745749    if (RT_UNLIKELY(!pTmpPlugins))
    746750        return VERR_NO_MEMORY;
    747     g_apFilterBackends = pTmp;
     751
    748752    g_ahFilterBackendPlugins = pTmpPlugins;
    749753    memcpy(&g_apFilterBackends[g_cFilterBackends], ppBackends, cBackends * sizeof(PCVDFILTERBACKEND));
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