Changeset 69968 in vbox
- Timestamp:
- Dec 7, 2017 10:54:35 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VDPlugin.cpp
r69753 r69968 94 94 /** Array of pointers to the cache backends. */ 95 95 static PCVDCACHEBACKEND *g_apCacheBackends = NULL; 96 /** Array of handles to the corresponding plugin. */ 96 /** Array of handles to the corresponding plugin. 97 * 98 * @todo r=bird: This looks rather pointless. 99 */ 97 100 static RTLDRMOD *g_ahCacheBackendPlugins = NULL; 98 101 /** Builtin cache backends. */ … … 159 162 static int vdAddCacheBackends(RTLDRMOD hPlugin, PCVDCACHEBACKEND *ppBackends, unsigned cBackends) 160 163 { 161 PCVDCACHEBACKEND *pTmp = (PCVDCACHEBACKEND*)RTMemRealloc(g_apCacheBackends, 162 (g_cCacheBackends + cBackends) * sizeof(PCVDCACHEBACKEND)); 164 PCVDCACHEBACKEND *pTmp = (PCVDCACHEBACKEND*)RTMemReallocTag(g_apCacheBackends, 165 (g_cCacheBackends + cBackends) * sizeof(PCVDCACHEBACKEND), 166 "may-leak:vdAddCacheBackend"); 163 167 if (RT_UNLIKELY(!pTmp)) 164 168 return VERR_NO_MEMORY; 165 169 g_apCacheBackends = pTmp; 166 170 167 RTLDRMOD *pTmpPlugins = (RTLDRMOD*)RTMemRealloc(g_ahCacheBackendPlugins, 168 (g_cCacheBackends + cBackends) * sizeof(RTLDRMOD)); 171 RTLDRMOD *pTmpPlugins = (RTLDRMOD*)RTMemReallocTag(g_ahCacheBackendPlugins, 172 (g_cCacheBackends + cBackends) * sizeof(RTLDRMOD), 173 "may-leak:vdAddCacheBackend"); 169 174 if (RT_UNLIKELY(!pTmpPlugins)) 170 175 return VERR_NO_MEMORY; … … 370 375 while (i < g_cBackends && g_ahBackendPlugins[i] == pIt->hPlugin) 371 376 { 372 mem cpy(&g_apBackends[i], &g_apBackends[i + 1], (g_cBackends - i - 1) * sizeof(PCVDIMAGEBACKEND));373 mem cpy(&g_ahBackendPlugins[i], &g_ahBackendPlugins[i + 1], (g_cBackends - i - 1) * sizeof(RTLDRMOD));377 memmove(&g_apBackends[i], &g_apBackends[i + 1], (g_cBackends - i - 1) * sizeof(PCVDIMAGEBACKEND)); 378 memmove(&g_ahBackendPlugins[i], &g_ahBackendPlugins[i + 1], (g_cBackends - i - 1) * sizeof(RTLDRMOD)); 374 379 /** @todo for now skip reallocating, doesn't save much */ 375 380 g_cBackends--; … … 380 385 while (i < g_cCacheBackends && g_ahCacheBackendPlugins[i] == pIt->hPlugin) 381 386 { 382 mem cpy(&g_apCacheBackends[i], &g_apCacheBackends[i + 1], (g_cCacheBackends - i - 1) * sizeof(PCVDCACHEBACKEND));383 mem cpy(&g_ahCacheBackendPlugins[i], &g_ahCacheBackendPlugins[i + 1], (g_cCacheBackends - i - 1) * sizeof(RTLDRMOD));387 memmove(&g_apCacheBackends[i], &g_apCacheBackends[i + 1], (g_cCacheBackends - i - 1) * sizeof(PCVDCACHEBACKEND)); 388 memmove(&g_ahCacheBackendPlugins[i], &g_ahCacheBackendPlugins[i + 1], (g_cCacheBackends - i - 1) * sizeof(RTLDRMOD)); 384 389 /** @todo for now skip reallocating, doesn't save much */ 385 390 g_cCacheBackends--; … … 390 395 while (i < g_cFilterBackends && g_pahFilterBackendPlugins[i] == pIt->hPlugin) 391 396 { 392 mem cpy(&g_apFilterBackends[i], &g_apFilterBackends[i + 1], (g_cFilterBackends - i - 1) * sizeof(PCVDFILTERBACKEND));393 mem cpy(&g_pahFilterBackendPlugins[i], &g_pahFilterBackendPlugins[i + 1], (g_cFilterBackends - i - 1) * sizeof(RTLDRMOD));397 memmove(&g_apFilterBackends[i], &g_apFilterBackends[i + 1], (g_cFilterBackends - i - 1) * sizeof(PCVDFILTERBACKEND)); 398 memmove(&g_pahFilterBackendPlugins[i], &g_pahFilterBackendPlugins[i + 1], (g_cFilterBackends - i - 1) * sizeof(RTLDRMOD)); 394 399 /** @todo for now skip reallocating, doesn't save much */ 395 400 g_cFilterBackends--; … … 870 875 return VERR_INTERNAL_ERROR; 871 876 877 if (g_ahCacheBackendPlugins) 878 RTMemFree(g_ahCacheBackendPlugins); 872 879 if (g_apCacheBackends) 873 880 RTMemFree(g_apCacheBackends); … … 880 887 g_cCacheBackends = 0; 881 888 g_apCacheBackends = NULL; 889 g_ahCacheBackendPlugins = NULL; 882 890 883 891 #ifndef VBOX_HDD_NO_DYNAMIC_BACKENDS
Note:
See TracChangeset
for help on using the changeset viewer.