IMalloc::ReAlloc() fix
Dimitrie O. Paun
dpaun at rogers.com
Tue Nov 25 00:19:00 CST 2003
ChangeLog
Fix the IMalloc::ReAlloc() to follow the documented behavior.
Index: dlls/ole32/ifs.c
===================================================================
RCS file: /var/cvs/wine/dlls/ole32/ifs.c,v
retrieving revision 1.31
diff -u -r1.31 ifs.c
--- dlls/ole32/ifs.c 11 Sep 2003 03:06:25 -0000 1.31
+++ dlls/ole32/ifs.c 25 Nov 2003 05:56:09 -0000
@@ -209,7 +209,12 @@
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);
Index: dlls/ole32/ole16.c
===================================================================
RCS file: /var/cvs/wine/dlls/ole32/ole16.c,v
retrieving revision 1.8
diff -u -r1.8 ole16.c
--- dlls/ole32/ole16.c 30 Sep 2003 00:24:08 -0000 1.8
+++ dlls/ole32/ole16.c 25 Nov 2003 06:17:02 -0000
@@ -120,8 +120,16 @@
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);
+ if (!pv)
+ ret = IMalloc16_fnAlloc(iface, cb);
+ else if (cb) {
+ ret = MapLS( HeapReAlloc( GetProcessHeap(), 0, MapSL(pv), cb ) );
+ UnMapLS(pv);
+ } else {
+ VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,SEGPTR pv);
+ IMalloc16_fnFree(iface, pv);
+ ret = 0;
+ }
return ret;
}
--
Dimi.
More information about the wine-patches
mailing list