Browse code

Stop LeakSanitizer complaining about Uxn's RAM.

Andrew Alderwick authored on 05/01/2022 18:18:13
Showing 2 changed files
... ...
@@ -133,13 +133,16 @@ load(Uxn *u, char *filepath)
133 133
 	return 1;
134 134
 }
135 135
 
136
+static Uint8 *memory;
137
+
136 138
 int
137 139
 main(int argc, char **argv)
138 140
 {
139 141
 	Uxn u;
140 142
 	int i, loaded = 0;
141 143
 
142
-	if(!uxn_boot(&u, (Uint8 *)calloc(0xffff, sizeof(Uint8))))
144
+	memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
145
+	if(!uxn_boot(&u, memory))
143 146
 		return error("Boot", "Failed");
144 147
 
145 148
 	/* system   */ devsystem = uxn_port(&u, 0x0, system_dei, system_deo);
... ...
@@ -271,10 +271,12 @@ load(Uxn *u, char *rom)
271 271
 	return 1;
272 272
 }
273 273
 
274
+static Uint8 *memory;
275
+
274 276
 static int
275 277
 start(Uxn *u, char *rom)
276 278
 {
277
-	Uint8 *memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
279
+	memory = (Uint8 *)calloc(0xffff, sizeof(Uint8));
278 280
 	if(!uxn_boot(u, memory))
279 281
 		return error("Boot", "Failed to start uxn.");
280 282
 	if(!load(u, rom))