From d9636260442292990bab00aec308116f3062f3ad Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 30 Oct 2023 20:31:58 -0600 Subject: [PATCH] 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; } -- 2.11.4.GIT