aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;