mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-01 07:30:45 +00:00
Don't leak stuff-n-things, thank you Valgrind =)
- Major : Previously leaking interface threads - Major : Leak of FILE* resources in inflate routine - Minor : previous leak-on-exit of enumerated sound devices
This commit is contained in:
parent
80b880550f
commit
3b13fc29a4
@ -245,6 +245,19 @@ bool DSZeroVoiceWritableBuffer(PVOICE Voice, char* pszDevName, DWORD dwBufferSiz
|
||||
|
||||
static UINT g_uDSInitRefCount = 0;
|
||||
|
||||
static void _destroy_enumerated_sound_devices(void) {
|
||||
if (sound_devices) {
|
||||
LOG("Destroying old device names...");
|
||||
char **ptr = sound_devices;
|
||||
while (*ptr) {
|
||||
FREE(*ptr);
|
||||
++ptr;
|
||||
}
|
||||
FREE(sound_devices);
|
||||
sound_devices = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool DSInit()
|
||||
{
|
||||
if(g_bDSAvailable)
|
||||
@ -253,18 +266,7 @@ bool DSInit()
|
||||
return true; // Already initialised successfully
|
||||
}
|
||||
|
||||
if (sound_devices)
|
||||
{
|
||||
LOG("Destroying old device names...");
|
||||
char **ptr = sound_devices;
|
||||
while (*ptr)
|
||||
{
|
||||
FREE(*ptr);
|
||||
++ptr;
|
||||
}
|
||||
FREE(sound_devices);
|
||||
sound_devices = NULL;
|
||||
}
|
||||
_destroy_enumerated_sound_devices();
|
||||
num_sound_devices = SoundSystemEnumerate(&sound_devices, MAX_SOUND_DEVICES);
|
||||
HRESULT hr = (num_sound_devices <= 0);
|
||||
if(FAILED(hr))
|
||||
@ -308,6 +310,8 @@ bool DSInit()
|
||||
|
||||
void DSUninit()
|
||||
{
|
||||
_destroy_enumerated_sound_devices();
|
||||
|
||||
if(!g_bDSAvailable)
|
||||
return;
|
||||
|
||||
|
@ -1592,6 +1592,7 @@ void c_interface_begin(int current_key)
|
||||
{
|
||||
pthread_t t = 0;
|
||||
pthread_create(&t, NULL, (void *)&interface_thread, (void *)((__SWORD_TYPE)current_key));
|
||||
pthread_detach(t);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -182,7 +182,7 @@ const char *inf(const char* const src, int *rawcount)
|
||||
}
|
||||
dst[len-3] = '\0';
|
||||
|
||||
FILE *dest = fopen(dst, "w+");
|
||||
dest = fopen(dst, "w+");
|
||||
if (dest == NULL) {
|
||||
ERRLOG("Cannot open file '%s' for writing", dst);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user