From cf066fd306a915963d6bf1379f6c81c4c924ff1e Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 17 Mar 2014 09:40:56 -0700 Subject: Don't assume the default mmdevapi device is in the collection --- Alc/backends/mmdevapi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Alc/backends') diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c index b93ff667..24769213 100644 --- a/Alc/backends/mmdevapi.c +++ b/Alc/backends/mmdevapi.c @@ -186,7 +186,7 @@ static DevMap *ProbeDevices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, ALu hr = IMMDeviceCollection_GetCount(coll, &count); if(SUCCEEDED(hr) && count > 0) { - devlist = calloc(count, sizeof(*devlist)); + devlist = calloc(count+1, sizeof(*devlist)); if(!devlist) { IMMDeviceCollection_Release(coll); @@ -199,7 +199,7 @@ static DevMap *ProbeDevices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, ALu if(SUCCEEDED(hr) && defdev != NULL) add_device(defdev, &devlist[idx++]); - for(i = 0;i < count && idx < count;++i) + for(i = 0;i < count;++i) { IMMDevice *device; -- cgit v1.2.3