From f48a09c48208fdcd92bd777f9e0797cc5b2da8ad Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Wed, 5 Jan 2022 18:18:13 +0000 Subject: [PATCH] Stop LeakSanitizer complaining about Uxn's RAM. --- src/uxncli.c | 5 ++++- src/uxnemu.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/uxncli.c b/src/uxncli.c index 4126411..f7e14e2 100644 --- 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 index bc6bac2..0134177 100644 --- 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))