aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/mmdevapi.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-03-17 09:40:56 -0700
committerChris Robinson <[email protected]>2014-03-17 09:40:56 -0700
commitcf066fd306a915963d6bf1379f6c81c4c924ff1e (patch)
tree78790bc30ef3a00ab57a7ac97e61acafbd9eca16 /Alc/backends/mmdevapi.c
parentbb787ba8ee6971434572418222df417374254c01 (diff)
Don't assume the default mmdevapi device is in the collection
Diffstat (limited to 'Alc/backends/mmdevapi.c')
-rw-r--r--Alc/backends/mmdevapi.c4
1 files changed, 2 insertions, 2 deletions
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;