2014-01-05 16:26:32 -08:00
|
|
|
From 1845d1db19da5e3007231e2632d9ed093b8faa11 Mon Sep 17 00:00:00 2001
|
2013-12-06 12:09:21 -08:00
|
|
|
From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
|
2014-01-05 16:26:32 -08:00
|
|
|
Date: Sat, 4 Jan 2014 07:08:55 +0100
|
2013-12-06 12:09:21 -08:00
|
|
|
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
|
|
|
|
--
|
2014-01-05 16:26:32 -08:00
|
|
|
1.8.5.2
|
2013-12-06 12:09:21 -08:00
|
|
|
|