Module: wine Branch: master Commit: 269ce609d9523ab8f4f595bd4336f22a5fbff7c7 URL: https://gitlab.winehq.org/wine/wine/-/commit/269ce609d9523ab8f4f595bd4336f22...
Author: Alex Henrie alexhenrie24@gmail.com Date: Sat Sep 16 11:43:50 2023 -0600
dsound: Use malloc and free instead of _recalloc.
The memory is completely overwritten a few lines later, so there is no reason to preserve its original contents. Furthermore, _recalloc will not be available if this DLL switches from ucrtbase to msvcrt, and the code as written would leak memory if _recalloc failed.
---
dlls/dsound/capture.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c index ca01543f358..5956da792af 100644 --- a/dlls/dsound/capture.c +++ b/dlls/dsound/capture.c @@ -178,7 +178,8 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(IDirectSou if (howmuch > 0) { /* Make an internal copy of the caller-supplied array. * Replace the existing copy if one is already present. */ - This->notifies = _recalloc(This->notifies, howmuch, sizeof(DSBPOSITIONNOTIFY)); + free(This->notifies); + This->notifies = malloc(howmuch * sizeof(DSBPOSITIONNOTIFY)); if (!This->notifies) { WARN("out of memory\n"); return DSERR_OUTOFMEMORY;