aboutsummaryrefslogtreecommitdiffstats
path: root/router/alc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-06-28 22:39:11 -0700
committerChris Robinson <[email protected]>2017-06-28 22:39:11 -0700
commitef7eced7a700ba12badf412e21e682b1b1c60683 (patch)
tree21204e709e8ffdf6e015e2565fcb0ecaab2d79c4 /router/alc.c
parenta729007887d771ee927da1ef1bc832502e17b2a1 (diff)
Properly clean up allocated memory at exit
Diffstat (limited to 'router/alc.c')
-rw-r--r--router/alc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/router/alc.c b/router/alc.c
index 704aa146..87f1e3f7 100644
--- a/router/alc.c
+++ b/router/alc.c
@@ -240,8 +240,8 @@ static const ALCint alcMinorVersion = 1;
static ATOMIC(ALCenum) LastError = ATOMIC_INIT_STATIC(ALC_NO_ERROR);
-PtrIntMap DeviceIfaceMap = PTRINTMAP_STATIC_INITIALIZE;
-PtrIntMap ContextIfaceMap = PTRINTMAP_STATIC_INITIALIZE;
+static PtrIntMap DeviceIfaceMap = PTRINTMAP_STATIC_INITIALIZE;
+static PtrIntMap ContextIfaceMap = PTRINTMAP_STATIC_INITIALIZE;
typedef struct EnumeratedList {
@@ -317,6 +317,16 @@ static ALint GetDriverIndexForName(const EnumeratedList *list, const ALCchar *na
return -1;
}
+void ReleaseALC(void)
+{
+ ClearDeviceList(&DevicesList);
+ ClearDeviceList(&AllDevicesList);
+ ClearDeviceList(&CaptureDevicesList);
+
+ ResetPtrIntMap(&ContextIfaceMap);
+ ResetPtrIntMap(&DeviceIfaceMap);
+}
+
ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename)
{