diff options
author | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2013-07-20 20:10:24 -0300 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-22 02:42:38 +0200 |
commit | 56274c6664fa38096a79dd92bfc42c6e9f67d94c (patch) | |
tree | cd2155fc7ad67bf92dcdfc34cef7ae22b40a4038 /audio | |
parent | 32cb190855bf9547ba70cef1c320c2033d8fcded (diff) | |
download | mpv-56274c6664fa38096a79dd92bfc42c6e9f67d94c.tar.bz2 mpv-56274c6664fa38096a79dd92bfc42c6e9f67d94c.tar.xz |
ao_wasapi: Don't leak the default device's ID when listing devices
Also remove unused variable.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao_wasapi.c | 7 |
1 files changed, 4 insertions, 3 deletions
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)); |