Commit 4a315cd7 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

oleaut32: Grow the marshalling buffer exponentially.

parent a58c4df5
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment