Module: wine Branch: master Commit: d9636260442292990bab00aec308116f3062f3ad URL: https://gitlab.winehq.org/wine/wine/-/commit/d9636260442292990bab00aec308116...
Author: Paul Gofman pgofman@codeweavers.com Date: Mon Oct 30 20:31:58 2023 -0600
winmm: Fix pszSound allocation in PlaySound_Alloc().
---
dlls/winmm/playsound.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c index 2ba2ad1e8dc..bd26bf481f3 100644 --- a/dlls/winmm/playsound.c +++ b/dlls/winmm/playsound.c @@ -231,8 +231,9 @@ static WINE_PLAYSOUND* PlaySound_Alloc(const void* pszSound, HMODULE hmod, else { UNICODE_STRING usBuffer; - RtlCreateUnicodeStringFromAsciiz(&usBuffer, pszSound); - wps->pszSound = usBuffer.Buffer; + if (!RtlCreateUnicodeStringFromAsciiz(&usBuffer, pszSound)) goto oom_error; + wps->pszSound = wcsdup(usBuffer.Buffer); + RtlFreeUnicodeString(&usBuffer); if (!wps->pszSound) goto oom_error; wps->bAlloc = TRUE; }