aboutsummaryrefslogtreecommitdiffstats
path: root/router
diff options
context:
space:
mode:
Diffstat (limited to 'router')
-rw-r--r--router/alc.c13
-rw-r--r--router/router.c13
2 files changed, 14 insertions, 12 deletions
diff --git a/router/alc.c b/router/alc.c
index c5840154..c4536cce 100644
--- a/router/alc.c
+++ b/router/alc.c
@@ -8,6 +8,7 @@
#include "AL/alc.h"
#include "router.h"
+#include "almalloc.h"
#define COUNTOF(x) (sizeof(x)/sizeof(x[0]))
@@ -257,11 +258,11 @@ static EnumeratedList CaptureDevicesList = { NULL, NULL, NULL, 0 };
static void ClearDeviceList(EnumeratedList *list)
{
- free(list->Names);
+ al_free(list->Names);
list->Names = NULL;
list->NamesEnd = NULL;
- free(list->Indicies);
+ al_free(list->Indicies);
list->Indicies = NULL;
list->IndexSize = 0;
}
@@ -287,19 +288,19 @@ static void AppendDeviceList(EnumeratedList *list, const ALCchar *names, ALint i
return;
len = (list->NamesEnd - list->Names) + (name_end - names);
- new_list = calloc(1, len + 1);
+ new_list = al_calloc(DEF_ALIGN, len + 1);
memcpy(new_list, list->Names, list->NamesEnd - list->Names);
memcpy(new_list + (list->NamesEnd - list->Names), names, name_end - names);
- free(list->Names);
+ al_free(list->Names);
list->Names = new_list;
list->NamesEnd = list->Names + len;
- new_indicies = calloc(sizeof(ALCint), list->IndexSize + count);
+ new_indicies = al_calloc(16, sizeof(ALCint)*(list->IndexSize + count));
for(i = 0;i < list->IndexSize;i++)
new_indicies[i] = list->Indicies[i];
for(i = 0;i < count;i++)
new_indicies[list->IndexSize+i] = idx;
- free(list->Indicies);
+ al_free(list->Indicies);
list->Indicies = new_indicies;
list->IndexSize += count;
}
diff --git a/router/router.c b/router/router.c
index 9522814d..53229aca 100644
--- a/router/router.c
+++ b/router/router.c
@@ -9,6 +9,7 @@
#include "AL/alc.h"
#include "AL/al.h"
+#include "almalloc.h"
DriverIface *DriverList = NULL;
@@ -73,7 +74,7 @@ BOOL APIENTRY DllMain(HINSTANCE UNUSED(module), DWORD reason, void* UNUSED(reser
if(DriverList[i].Module)
FreeLibrary(DriverList[i].Module);
}
- free(DriverList);
+ al_free(DriverList);
DriverList = NULL;
DriverListSize = 0;
DriverListSizeMax = 0;
@@ -118,11 +119,11 @@ static void AddModule(HMODULE module, const WCHAR *name)
if(DriverListSize == DriverListSizeMax)
{
int newmax = DriverListSizeMax ? DriverListSizeMax<<1 : 4;
- void *newlist = calloc(sizeof(DriverList[0]), newmax);
+ void *newlist = al_calloc(DEF_ALIGN, sizeof(DriverList[0])*newmax);
if(!newlist) return;
memcpy(newlist, DriverList, DriverListSize*sizeof(DriverList[0]));
- free(DriverList);
+ al_free(DriverList);
DriverList = newlist;
DriverListSizeMax = newmax;
}
@@ -351,7 +352,7 @@ void InitPtrIntMap(PtrIntMap *map)
void ResetPtrIntMap(PtrIntMap *map)
{
WriteLock(&map->lock);
- free(map->keys);
+ al_free(map->keys);
map->keys = NULL;
map->values = NULL;
map->size = 0;
@@ -390,7 +391,7 @@ ALenum InsertPtrIntMapEntry(PtrIntMap *map, ALvoid *key, ALint value)
newcap = (map->capacity ? (map->capacity<<1) : 4);
if(newcap > map->capacity)
- keys = calloc(sizeof(map->keys[0])+sizeof(map->values[0]), newcap);
+ keys = al_calloc(16, (sizeof(map->keys[0])+sizeof(map->values[0]))*newcap);
if(!keys)
{
WriteUnlock(&map->lock);
@@ -403,7 +404,7 @@ ALenum InsertPtrIntMapEntry(PtrIntMap *map, ALvoid *key, ALint value)
memcpy(keys, map->keys, map->size*sizeof(map->keys[0]));
memcpy(values, map->values, map->size*sizeof(map->values[0]));
}
- free(map->keys);
+ al_free(map->keys);
map->keys = keys;
map->values = values;
map->capacity = newcap;