summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-10-04 22:06:19 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-10-04 22:06:19 +0200
commita266e118c5ed4db6752a30546f0e33e7c6f4caf4 (patch)
treece01a04385d0f77b4662e335f486d74ec2e5d346
parent5b7315ebdcf024000a29244d75ab8bef697c2b07 (diff)
fixed few memleaks in ao dsf
-rw-r--r--plugins/ao/eng_dsf/aica.c1
-rw-r--r--plugins/ao/eng_dsf/arm7.c4
-rw-r--r--plugins/ao/eng_dsf/arm7.h2
-rw-r--r--plugins/ao/eng_dsf/eng_dsf.c14
4 files changed, 18 insertions, 3 deletions
diff --git a/plugins/ao/eng_dsf/aica.c b/plugins/ao/eng_dsf/aica.c
index 09855a04..f504d647 100644
--- a/plugins/ao/eng_dsf/aica.c
+++ b/plugins/ao/eng_dsf/aica.c
@@ -484,7 +484,6 @@ static void AICA_StopSlot(struct _SLOT *slot,int keyoff)
static void AICA_Init(struct _AICA *AICA, const struct AICAinterface *intf)
{
- printf ("AICA_Init(cpu=%p)\n", intf->cpu);
int i=0;
AICA->IrqTimA = AICA->IrqTimBC = AICA->IrqMidi = 0;
diff --git a/plugins/ao/eng_dsf/arm7.c b/plugins/ao/eng_dsf/arm7.c
index 0bc35705..b4314948 100644
--- a/plugins/ao/eng_dsf/arm7.c
+++ b/plugins/ao/eng_dsf/arm7.c
@@ -44,6 +44,10 @@ struct sARM7* ARM7_Alloc ()
return cpu;
}
+void ARM7_Free (struct sARM7 *cpu) {
+ free (cpu);
+}
+
//--------------------------------------------------------------------------
/** ARM7 emulator init. */
void ARM7_Init (struct sARM7 *cpu)
diff --git a/plugins/ao/eng_dsf/arm7.h b/plugins/ao/eng_dsf/arm7.h
index 3c9a47db..37f33a3d 100644
--- a/plugins/ao/eng_dsf/arm7.h
+++ b/plugins/ao/eng_dsf/arm7.h
@@ -130,6 +130,8 @@ struct sARM7
/** ARM7 allocate spu state. */
struct sARM7* ARM7_Alloc (void);
+void ARM7_Free (struct sARM7 *cpu);
+
/** ARM7 emulator init. */
void ARM7_Init (struct sARM7 *cpu);
diff --git a/plugins/ao/eng_dsf/eng_dsf.c b/plugins/ao/eng_dsf/eng_dsf.c
index b58b6ed4..6cab9509 100644
--- a/plugins/ao/eng_dsf/eng_dsf.c
+++ b/plugins/ao/eng_dsf/eng_dsf.c
@@ -21,7 +21,7 @@
#include "aica.h"
#include "aicadsp.h"
-#define DEBUG_LOADER (1)
+#define DEBUG_LOADER (0)
#define DK_CORE (1)
#if DK_CORE
@@ -43,7 +43,7 @@ void *dsf_start(const char *path, uint8 *buffer, uint32 length)
dsf_synth_t *s = malloc (sizeof (dsf_synth_t));
memset (s, 0, sizeof (dsf_synth_t));
- uint8 *file, *lib_decoded, *lib_raw_file;
+ uint8 *file = NULL, *lib_decoded = NULL, *lib_raw_file = NULL;
uint32 offset, plength, lengthMS, fadeMS;
uint64 file_len, lib_len, lib_raw_length;
corlett_t *lib;
@@ -108,6 +108,7 @@ void *dsf_start(const char *path, uint8 *buffer, uint32 length)
memcpy(&s->cpu->dc_ram[offset], lib_decoded+4, lib_len-4);
// Dispose the corlett structure for the lib - we don't use it
+ free(lib_decoded);
free(lib);
}
}
@@ -234,6 +235,15 @@ int32 dsf_gen(void *handle, int16 *buffer, uint32 samples)
int32 dsf_stop(void *handle)
{
+ dsf_synth_t *s = handle;
+ if (s->cpu) {
+ dc_hw_free (s->cpu);
+ ARM7_Free (s->cpu);
+ }
+ if (s->c) {
+ free (s->c);
+ }
+ free (s);
return AO_SUCCESS;
}