commit f48a09c48208fdcd92bd777f9e0797cc5b2da8ad
parent 9024963de1f62eb8e4a0cc2aeb98030b74483c37
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Wed, 5 Jan 2022 18:18:13 +0000
Stop LeakSanitizer complaining about Uxn's RAM.
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/uxncli.c b/src/uxncli.c
@@ -133,13 +133,16 @@ load(Uxn *u, char *filepath)
return 1;
}
+static Uint8 *memory;
+
int
main(int argc, char **argv)
{
Uxn u;
int i, loaded = 0;
- if(!uxn_boot(&u, (Uint8 *)calloc(0xffff, sizeof(Uint8))))
+ memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
+ if(!uxn_boot(&u, memory))
return error("Boot", "Failed");
/* system */ devsystem = uxn_port(&u, 0x0, system_dei, system_deo);
diff --git a/src/uxnemu.c b/src/uxnemu.c
@@ -271,10 +271,12 @@ load(Uxn *u, char *rom)
return 1;
}
+static Uint8 *memory;
+
static int
start(Uxn *u, char *rom)
{
- Uint8 *memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
+ memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
if(!uxn_boot(u, memory))
return error("Boot", "Failed to start uxn.");
if(!load(u, rom))