Dmitry Timoshkov : oleaut32: Grow the marshalling buffer exponentially.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 26 11:03:57 CST 2015


Module: wine
Branch: master
Commit: 4a315cd78a3c97d76ae06e3185ab01a70eb9a1a2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4a315cd78a3c97d76ae06e3185ab01a70eb9a1a2

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Nov 26 14:52:03 2015 +0800

oleaut32: Grow the marshalling buffer exponentially.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleaut32/tmarshal.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/oleaut32/tmarshal.c b/dlls/oleaut32/tmarshal.c
index f4ce311..5fd1fdd 100644
--- a/dlls/oleaut32/tmarshal.c
+++ b/dlls/oleaut32/tmarshal.c
@@ -79,12 +79,14 @@ xbuf_resize(marshal_state *buf, DWORD newsize)
 
     if(buf->base)
     {
+        newsize = max(newsize, buf->size * 2);
         buf->base = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buf->base, newsize);
         if(!buf->base)
             return E_OUTOFMEMORY;
     }
     else
     {
+        newsize = max(newsize, 256);
         buf->base = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, newsize);
         if(!buf->base)
             return E_OUTOFMEMORY;
@@ -100,7 +102,7 @@ xbuf_add(marshal_state *buf, const BYTE *stuff, DWORD size)
 
     if(buf->size - buf->curoff < size)
     {
-        hr = xbuf_resize(buf, buf->size + size + 100);
+        hr = xbuf_resize(buf, buf->size + size);
         if(FAILED(hr)) return hr;
     }
     memcpy(buf->base+buf->curoff,stuff,size);




More information about the wine-cvs mailing list