[PATCH 0/1] MR3869: 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. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3869
From: Alex Henrie <alexhenrie24(a)gmail.com> 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; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3869
participants (2)
-
Alex Henrie -
Alex Henrie (@alexhenrie)