Module: wine Branch: master Commit: ca1d074c50493f032c60be627309e9b1eee53678 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ca1d074c50493f032c60be6273...
Author: Ken Thomases ken@codeweavers.com Date: Mon Feb 23 17:33:58 2009 -0600
dsound: Replace a realloc-or-alloc with a free-then-alloc.
The buffer is to be overwritten anyway, so there's no need to preserve its contents. Also, the old code leaked if the realloc were to fail. All in all, free-then-alloc is simpler.
---
dlls/dsound/buffer.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c index 038a90e..abff0c9 100644 --- a/dlls/dsound/buffer.c +++ b/dlls/dsound/buffer.c @@ -117,11 +117,8 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions( } else if (howmuch > 0) { /* Make an internal copy of the caller-supplied array. * Replace the existing copy if one is already present. */ - if (This->dsb->notifies) - This->dsb->notifies = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - This->dsb->notifies, howmuch * sizeof(DSBPOSITIONNOTIFY)); - else - This->dsb->notifies = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + HeapFree(GetProcessHeap(), 0, This->dsb->notifies); + This->dsb->notifies = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, howmuch * sizeof(DSBPOSITIONNOTIFY));
if (This->dsb->notifies == NULL) {