When function scheme_load_named_file() was called multiple times with the same argument, it will crash whole interpreter with this message:
*** glibc detected *** ./scheme: malloc(): memory corruption: 0x000000000072f200 *** *** glibc detected *** ./scheme: malloc(): memory corruption: 0x000000000072f200 *** *** glibc detected *** ./scheme: malloc(): memory corruption: 0x000000000072f200 *** *** glibc detected *** ./scheme: malloc(): memory corruption: 0x000000000072f200 *** *** glibc detected *** ./scheme: malloc(): memory corruption: 0x000000000072f200 *** *** glibc detected *** ./scheme: malloc(): memory corruption: 0x000000000072f200 *** *** glibc detected *** ./scheme: malloc(): memory corruption: 0x000000000072f200 *** *** glibc detected *** ./scheme: malloc(): memory corruption: 0x000000000072f200 *** *** glibc detected *** ./scheme: malloc(): memory corruption: 0x000000000072f200 ***
How to reproduce it: open scheme.c and put somewhere (after init.scm was loaded something like):
scheme_load_named_file(&sc, fin, "init.scm"); scheme_load_named_file(&sc, fin, "init.scm"); scheme_load_named_file(&sc, fin, "init.scm");
you will get the crash.
I noticed also that '(load)' will correctly utilize load_stack via file_push(), which isn't the case with scheme_load_named_file(): the later will use only first stack element, causing gc() to wrongly try to free object port which isn't allocated.
Any ideas?
Ticket moved from /p/tinyscheme/patches/9/
I just ran a test of calling scheme_load_named_file() four times in a row and it worked without crashing. Can you still reproduce the problem? If not, this bug can be closed as obsolete.