Properly clean up allocated memory at exit
This commit is contained in:
+12
-2
@@ -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)
|
||||
{
|
||||
|
||||
+1
-2
@@ -33,8 +33,7 @@ BOOL APIENTRY DllMain(HINSTANCE module, DWORD reason, void *reserved)
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
ResetPtrIntMap(&ContextIfaceMap);
|
||||
ResetPtrIntMap(&DeviceIfaceMap);
|
||||
ReleaseALC();
|
||||
for(i = 0;i < DriverListSize;i++)
|
||||
{
|
||||
if(DriverList[i].Module)
|
||||
|
||||
+1
-2
@@ -135,7 +135,6 @@ ALint RemovePtrIntMapKey(PtrIntMap *map, ALvoid *key);
|
||||
ALint LookupPtrIntMapKey(PtrIntMap *map, ALvoid *key);
|
||||
|
||||
|
||||
extern PtrIntMap DeviceIfaceMap;
|
||||
extern PtrIntMap ContextIfaceMap;
|
||||
void ReleaseALC(void);
|
||||
|
||||
#endif /* ROUTER_ROUTER_H */
|
||||
|
||||
Reference in New Issue
Block a user