mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 14:40:56 +00:00
Fix the IMalloc::ReAlloc() to follow the documented behavior.
This commit is contained in:
parent
cba157e998
commit
d8aa853596
@ -209,7 +209,12 @@ static LPVOID WINAPI IMalloc_fnRealloc(LPMALLOC iface,LPVOID pv,DWORD cb) {
|
||||
pv = pRealMemory;
|
||||
}
|
||||
|
||||
pNewMemory = HeapReAlloc(GetProcessHeap(),0,pv,cb);
|
||||
if (!pv) pNewMemory = HeapAlloc(GetProcessHeap(),0,cb);
|
||||
else if (cb) pNewMemory = HeapReAlloc(GetProcessHeap(),0,pv,cb);
|
||||
else {
|
||||
HeapFree(GetProcessHeap(),0,pv);
|
||||
pNewMemory = NULL;
|
||||
}
|
||||
|
||||
if(Malloc32.pSpy) {
|
||||
pNewMemory = IMallocSpy_PostRealloc(Malloc32.pSpy, pNewMemory, TRUE);
|
||||
|
@ -112,19 +112,6 @@ SEGPTR WINAPI IMalloc16_fnAlloc(IMalloc16* iface,DWORD cb) {
|
||||
return MapLS( HeapAlloc( GetProcessHeap(), 0, cb ) );
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* IMalloc16_Realloc [COMPOBJ.504]
|
||||
*/
|
||||
SEGPTR WINAPI IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb)
|
||||
{
|
||||
SEGPTR ret;
|
||||
ICOM_THIS(IMalloc16Impl,iface);
|
||||
TRACE("(%p)->Realloc(%08lx,%ld)\n",This,pv,cb);
|
||||
ret = MapLS( HeapReAlloc( GetProcessHeap(), 0, MapSL(pv), cb ) );
|
||||
UnMapLS(pv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* IMalloc16_Free [COMPOBJ.505]
|
||||
*/
|
||||
@ -137,6 +124,26 @@ VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,SEGPTR pv)
|
||||
HeapFree( GetProcessHeap(), 0, ptr );
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* IMalloc16_Realloc [COMPOBJ.504]
|
||||
*/
|
||||
SEGPTR WINAPI IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb)
|
||||
{
|
||||
SEGPTR ret;
|
||||
ICOM_THIS(IMalloc16Impl,iface);
|
||||
TRACE("(%p)->Realloc(%08lx,%ld)\n",This,pv,cb);
|
||||
if (!pv)
|
||||
ret = IMalloc16_fnAlloc(iface, cb);
|
||||
else if (cb) {
|
||||
ret = MapLS( HeapReAlloc( GetProcessHeap(), 0, MapSL(pv), cb ) );
|
||||
UnMapLS(pv);
|
||||
} else {
|
||||
IMalloc16_fnFree(iface, pv);
|
||||
ret = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* IMalloc16_GetSize [COMPOBJ.506]
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user