Commit 52dd3156 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

amstream: Use CoTaskMemRealloc instead of alloc+copy.

parent f49d6df1
...@@ -279,15 +279,12 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream ...@@ -279,15 +279,12 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
hr = mediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream); hr = mediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
pNewStreams = CoTaskMemAlloc((This->nbStreams+1)*sizeof(IMediaStream*)); pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IMediaStream*));
if (!pNewStreams) if (!pNewStreams)
{ {
IMediaStream_Release(pStream); IMediaStream_Release(pStream);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
if (This->nbStreams)
CopyMemory(pNewStreams, This->pStreams, This->nbStreams*sizeof(IMediaStream*));
CoTaskMemFree(This->pStreams);
This->pStreams = pNewStreams; This->pStreams = pNewStreams;
This->pStreams[This->nbStreams] = pStream; This->pStreams[This->nbStreams] = pStream;
This->nbStreams++; This->nbStreams++;
......
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