shithub: sl

Download patch

ref: dc951aa077334fa07bf3b322164981928d72473a
parent: cd230a1b17495d478d359e5806972e72bc4b8b27
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sat Feb 1 15:43:26 EST 2025

flmain: fix boot image loading with GC activity in the middle of it

--- a/src/flmain.c
+++ b/src/flmain.c
@@ -33,6 +33,7 @@
 		exit(1);
 
 	value_t f = cvalue(FL(iostreamtype), (int)sizeof(ios_t));
+	fl_gc_handle(&f);
 	ios_t *s = value2c(ios_t*, f);
 	uint8_t *unpacked = nil;
 	if(boot[0] == 0){
@@ -56,6 +57,8 @@
 	FL_TRY_EXTERN{
 		if(fl_load_system_image(f) == 0){
 			MEM_FREE(unpacked);
+			s = value2c(ios_t*, f);
+			fl_free_gc_handles(1);
 			ios_close(s);
 			fl_applyn(1, symbol_value(symbol("__start", false)), argv_list(argc, argv));
 			r = 0;