From 56274c6664fa38096a79dd92bfc42c6e9f67d94c Mon Sep 17 00:00:00 2001 From: "Diogo Franco (Kovensky)" Date: Sat, 20 Jul 2013 20:10:24 -0300 Subject: ao_wasapi: Don't leak the default device's ID when listing devices Also remove unused variable. --- audio/out/ao_wasapi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'audio') diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c index 4d8280d9dd..7056f0d769 100644 --- a/audio/out/ao_wasapi.c +++ b/audio/out/ao_wasapi.c @@ -641,7 +641,7 @@ static HRESULT enumerate_with_state(char *header, int status, int with_id) { IMMDeviceCollection *pDevices = NULL; IMMDevice *pDevice = NULL; IPropertyStore *pProps = NULL; - LPWSTR idStr = NULL; + char *defid = NULL; CoInitialize(NULL); hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, @@ -653,7 +653,7 @@ static HRESULT enumerate_with_state(char *header, int status, int with_id) { &pDevice); EXIT_ON_ERROR(hr) - char *defid = get_device_id(pDevice); + defid = get_device_id(pDevice); SAFE_RELEASE(pDevice, IMMDevice_Release(pDevice)); @@ -690,12 +690,13 @@ static HRESULT enumerate_with_state(char *header, int status, int with_id) { free(id); SAFE_RELEASE(pDevice, IMMDevice_Release(pDevice)); } + free(defid); SAFE_RELEASE(pDevices, IMMDeviceCollection_Release(pDevices)); SAFE_RELEASE(pEnumerator, IMMDeviceEnumerator_Release(pEnumerator)); return hr; exit_label: - CoTaskMemFree(idStr); + free(defid); SAFE_RELEASE(pProps, IPropertyStore_Release(pProps)); SAFE_RELEASE(pDevice, IMMDevice_Release(pDevice)); SAFE_RELEASE(pDevices, IMMDeviceCollection_Release(pDevices)); -- cgit v1.2.3