From 24bea94d01f605ec7e36568d892cbd012e5cc229 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Sun, 6 Jan 2008 01:24:16 +0000 Subject: [PATCH] (From Oliver Stoneberg) This fixes the winwork.c and poly(new).c meory leaks in the viper.c driver. I didn't look at the x86drc.c, because Aaron said it will be changed soon and there is no need to investigate those leaks at all. As I wanted to update my own personal TODO about that fix I recognised it only happens in viper.c as well, so I took a stab at it. It was just anothe rmissing cleanup function and I also cleaned up the *_exit() potions/usage of the cores supporting DRC a bit. --- src/emu/cpu/mips/mdrc64.c | 1 + src/emu/cpu/mips/mdrcold.c | 1 + src/emu/cpu/mips/mips3drc.c | 3 +-- src/emu/cpu/powerpc/drc_ops.c | 5 +++++ src/emu/cpu/powerpc/ppcdrc.c | 12 ++++++------ src/mame/drivers/viper.c | 6 ++++++ 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/emu/cpu/mips/mdrc64.c b/src/emu/cpu/mips/mdrc64.c index ce28941bb3e..c36bc8e88a7 100644 --- a/src/emu/cpu/mips/mdrc64.c +++ b/src/emu/cpu/mips/mdrc64.c @@ -482,6 +482,7 @@ static void mips3drc_exit(void) } } #endif + drc_exit(mips3.drc); } diff --git a/src/emu/cpu/mips/mdrcold.c b/src/emu/cpu/mips/mdrcold.c index d960eae06c0..e5b635c2e81 100644 --- a/src/emu/cpu/mips/mdrcold.c +++ b/src/emu/cpu/mips/mdrcold.c @@ -268,6 +268,7 @@ static void mips3drc_init(void) static void mips3drc_exit(void) { + drc_exit(mips3.drc); } diff --git a/src/emu/cpu/mips/mips3drc.c b/src/emu/cpu/mips/mips3drc.c index 08c48034c33..aa5a4e93b36 100644 --- a/src/emu/cpu/mips/mips3drc.c +++ b/src/emu/cpu/mips/mips3drc.c @@ -252,9 +252,8 @@ static void mips3_exit(void) x86log_free_context(mips3.log); /* clean up the DRC */ - mips3drc_exit(); drcfe_exit(mips3.drcfe); - drc_exit(mips3.drc); + mips3drc_exit(); /* free the cache */ osd_free_executable(mips3.core, CACHE_SIZE + sizeof(*mips3.core)); diff --git a/src/emu/cpu/powerpc/drc_ops.c b/src/emu/cpu/powerpc/drc_ops.c index b77e570aa74..3ee51150606 100644 --- a/src/emu/cpu/powerpc/drc_ops.c +++ b/src/emu/cpu/powerpc/drc_ops.c @@ -110,6 +110,11 @@ static void ppcdrc_reset(drc_core *drc) } } +static void ppcdrc_exit(void) +{ + drc_exit(ppc.drc); +} + static UINT32 *ppcdrc_getopptr(UINT32 address) { UINT32 *result; diff --git a/src/emu/cpu/powerpc/ppcdrc.c b/src/emu/cpu/powerpc/ppcdrc.c index 73e8ba3323e..fdc25a55ffa 100644 --- a/src/emu/cpu/powerpc/ppcdrc.c +++ b/src/emu/cpu/powerpc/ppcdrc.c @@ -1101,7 +1101,7 @@ static void ppcdrc403_exit(void) #if LOG_CODE //if (symfile) fclose(symfile); #endif - drc_exit(ppc.drc); + ppcdrc_exit(); } static void ppcdrc403_reset(void) @@ -1343,7 +1343,7 @@ static void ppcdrc603_exit(void) #if LOG_CODE //if (symfile) fclose(symfile); #endif - drc_exit(ppc.drc); + ppcdrc_exit(); } #endif @@ -1534,7 +1534,7 @@ static void ppcdrc602_exit(void) #if LOG_CODE //if (symfile) fclose(symfile); #endif - drc_exit(ppc.drc); + ppcdrc_exit(); } static void ppcdrc602_reset(void) @@ -1718,7 +1718,7 @@ static void mpc8240drc_init(int index, int clock, const void *_config, int (*irq static void mpc8240drc_exit(void) { - + ppcdrc_exit(); } #endif @@ -1865,7 +1865,7 @@ static void ppc601drc_exit(void) #if LOG_CODE //if (symfile) fclose(symfile); #endif - drc_exit(ppc.drc); + ppcdrc_exit(); } #endif @@ -1998,7 +1998,7 @@ static void ppc604drc_exit(void) #if LOG_CODE //if (symfile) fclose(symfile); #endif - drc_exit(ppc.drc); + ppcdrc_exit(); } #endif diff --git a/src/mame/drivers/viper.c b/src/mame/drivers/viper.c index 486880e4d11..6a38ad5cd3b 100644 --- a/src/mame/drivers/viper.c +++ b/src/mame/drivers/viper.c @@ -39,9 +39,15 @@ static UINT8 backup_ram[0x2000]; +static void viper_exit(running_machine *machine) +{ + voodoo_exit(0); +} static VIDEO_START(viper) { + add_exit_callback(machine, viper_exit); + voodoo_start(0, 0, VOODOO_3, 16, 16, 16); }