Module: wine Branch: master Commit: 6e9728bee52ac7e1f5a3d3bfe3bfaf5d9d1e01c1 URL: https://gitlab.winehq.org/wine/wine/-/commit/6e9728bee52ac7e1f5a3d3bfe3bfaf5...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Dec 8 16:09:19 2023 +0100
winepulse.drv: Don't free memory at process exit.
---
dlls/winepulse.drv/mmdevdrv.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 19d3d4040a3..0617c5977c9 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -72,10 +72,12 @@ static WCHAR drv_key_devicesW[256];
BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) { - if (reason == DLL_PROCESS_ATTACH) { - WCHAR buf[MAX_PATH]; - WCHAR *filename; + WCHAR buf[MAX_PATH]; + WCHAR *filename;
+ switch (reason) + { + case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(dll); if (__wine_init_unix_call()) return FALSE; @@ -87,11 +89,16 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
swprintf(drv_key_devicesW, ARRAY_SIZE(drv_key_devicesW), L"Software\Wine\Drivers\%s\devices", filename); - } else if (reason == DLL_PROCESS_DETACH) { - struct device_cache *device, *device_next; - - LIST_FOR_EACH_ENTRY_SAFE(device, device_next, &g_devices_cache, struct device_cache, entry) - free(device); + break; + case DLL_PROCESS_DETACH: + if (!reserved) + { + struct device_cache *device, *device_next; + + LIST_FOR_EACH_ENTRY_SAFE(device, device_next, &g_devices_cache, struct device_cache, entry) + free(device); + } + break; } return TRUE; }