mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
52 lines
1.7 KiB
Diff
52 lines
1.7 KiB
Diff
From 1845d1db19da5e3007231e2632d9ed093b8faa11 Mon Sep 17 00:00:00 2001
|
|
From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
|
|
Date: Sat, 4 Jan 2014 07:08:55 +0100
|
|
Subject: [PATCH 31/42] winepulse v23: fixup a invalid free in mmdevapi
|
|
|
|
array members of ids should be dynamically allocated, judging from valgrind output.
|
|
---
|
|
dlls/winepulse.drv/mmdevdrv.c | 12 ++++++++++--
|
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
|
|
index 3ca68fd..5b041a2 100644
|
|
--- a/dlls/winepulse.drv/mmdevdrv.c
|
|
+++ b/dlls/winepulse.drv/mmdevdrv.c
|
|
@@ -726,6 +726,8 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, const WCHAR ***ids, GUID **
|
|
UINT *num, UINT *def_index)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
+ WCHAR *id;
|
|
+
|
|
TRACE("%d %p %p %p\n", flow, ids, num, def_index);
|
|
|
|
pthread_mutex_lock(&pulse_lock);
|
|
@@ -737,16 +739,22 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, const WCHAR ***ids, GUID **
|
|
*def_index = 0;
|
|
|
|
*ids = HeapAlloc(GetProcessHeap(), 0, sizeof(**ids));
|
|
+ *keys = NULL;
|
|
if (!*ids)
|
|
return E_OUTOFMEMORY;
|
|
- (*ids)[0] = defaultW;
|
|
|
|
+ (*ids)[0] = id = HeapAlloc(GetProcessHeap(), 0, sizeof(defaultW));
|
|
*keys = HeapAlloc(GetProcessHeap(), 0, sizeof(**keys));
|
|
- if (!*keys) {
|
|
+ if (!*keys || !id) {
|
|
+ HeapFree(GetProcessHeap(), 0, id);
|
|
+ HeapFree(GetProcessHeap(), 0, *keys);
|
|
HeapFree(GetProcessHeap(), 0, *ids);
|
|
*ids = NULL;
|
|
+ *keys = NULL;
|
|
return E_OUTOFMEMORY;
|
|
}
|
|
+ memcpy(id, defaultW, sizeof(defaultW));
|
|
+
|
|
if (flow == eRender)
|
|
(*keys)[0] = pulse_render_guid;
|
|
else
|
|
--
|
|
1.8.5.2
|
|
|