dsound: Fix a memory leak.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
01439ef590
commit
c39121fc97
|
@ -89,7 +89,7 @@ CRITICAL_SECTION DSOUND_capturers_lock = { &DSOUND_capturers_lock_debug, -1, 0,
|
|||
GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
|
||||
GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
|
||||
|
||||
WCHAR wine_vxd_drv[] = { 'w','i','n','e','m','m','.','v','x','d', 0 };
|
||||
const WCHAR wine_vxd_drv[] = { 'w','i','n','e','m','m','.','v','x','d', 0 };
|
||||
|
||||
/* All default settings, you most likely don't want to touch these, see wiki on UsefulRegistryKeys */
|
||||
int ds_hel_buflen = 32768 * 2;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "uuids.h"
|
||||
|
||||
#include "wine/list.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#define DS_MAX_CHANNELS 6
|
||||
|
||||
|
@ -254,7 +255,7 @@ extern struct list DSOUND_renderers DECLSPEC_HIDDEN;
|
|||
extern GUID DSOUND_renderer_guids[MAXWAVEDRIVERS] DECLSPEC_HIDDEN;
|
||||
extern GUID DSOUND_capture_guids[MAXWAVEDRIVERS] DECLSPEC_HIDDEN;
|
||||
|
||||
extern WCHAR wine_vxd_drv[] DECLSPEC_HIDDEN;
|
||||
extern const WCHAR wine_vxd_drv[] DECLSPEC_HIDDEN;
|
||||
|
||||
void setup_dsound_options(void) DECLSPEC_HIDDEN;
|
||||
|
||||
|
@ -264,3 +265,15 @@ BOOL DSOUND_check_supported(IAudioClient *client, DWORD rate,
|
|||
DWORD depth, WORD channels) DECLSPEC_HIDDEN;
|
||||
HRESULT enumerate_mmdevices(EDataFlow flow, GUID *guids,
|
||||
LPDSENUMCALLBACKW cb, void *user) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline WCHAR *strdupW( const WCHAR *str )
|
||||
{
|
||||
size_t size;
|
||||
WCHAR *ret;
|
||||
|
||||
if (!str) return NULL;
|
||||
size = (strlenW( str ) + 1) * sizeof(WCHAR);
|
||||
ret = HeapAlloc( GetProcessHeap(), 0, size );
|
||||
if (ret) memcpy( ret, str, size );
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -200,7 +200,6 @@ static HRESULT DSPROPERTY_DescriptionW(
|
|||
IMMDevice *mmdevice;
|
||||
IPropertyStore *ps;
|
||||
PROPVARIANT pv;
|
||||
DWORD desclen;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("pPropData=%p,cbPropData=%d,pcbReturned=%p)\n",
|
||||
|
@ -248,12 +247,9 @@ static HRESULT DSPROPERTY_DescriptionW(
|
|||
return hr;
|
||||
}
|
||||
|
||||
desclen = lstrlenW(pv.u.pwszVal) + 1;
|
||||
/* FIXME: Still a memory leak.. */
|
||||
ppd->Description = HeapAlloc(GetProcessHeap(), 0, desclen * sizeof(WCHAR));
|
||||
memcpy(ppd->Description, pv.u.pwszVal, desclen * sizeof(WCHAR));
|
||||
ppd->Module = wine_vxd_drv;
|
||||
ppd->Interface = wInterface;
|
||||
ppd->Description = strdupW(pv.u.pwszVal);
|
||||
ppd->Module = strdupW(wine_vxd_drv);
|
||||
ppd->Interface = strdupW(wInterface);
|
||||
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
||||
|
||||
PropVariantClear(&pv);
|
||||
|
@ -463,6 +459,7 @@ static HRESULT DSPROPERTY_DescriptionA(
|
|||
return hr;
|
||||
if (!DSPROPERTY_descWtoA(&data, ppd))
|
||||
hr = E_OUTOFMEMORY;
|
||||
HeapFree(GetProcessHeap(), 0, data.Description);
|
||||
HeapFree(GetProcessHeap(), 0, data.Module);
|
||||
HeapFree(GetProcessHeap(), 0, data.Interface);
|
||||
return hr;
|
||||
|
@ -488,6 +485,7 @@ static HRESULT DSPROPERTY_Description1(
|
|||
if (FAILED(hr))
|
||||
return hr;
|
||||
DSPROPERTY_descWto1(&data, ppd);
|
||||
HeapFree(GetProcessHeap(), 0, data.Description);
|
||||
HeapFree(GetProcessHeap(), 0, data.Module);
|
||||
HeapFree(GetProcessHeap(), 0, data.Interface);
|
||||
return hr;
|
||||
|
|
Loading…
Reference in New Issue