mirror of
https://github.com/janet-lang/janet
synced 2024-12-26 16:30:26 +00:00
Fix for double free on fclose due to GC not knowing it failed
This commit is contained in:
parent
fff66649aa
commit
ee94828355
@ -279,7 +279,10 @@ static Janet cfun_io_fclose(int32_t argc, Janet *argv) {
|
|||||||
return janet_wrap_integer(WEXITSTATUS(status));
|
return janet_wrap_integer(WEXITSTATUS(status));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (fclose(iof->file)) janet_panic("could not close file");
|
if (fclose(iof->file)) {
|
||||||
|
iof->flags |= JANET_FILE_NOT_CLOSEABLE;
|
||||||
|
janet_panic("could not close file");
|
||||||
|
}
|
||||||
iof->flags |= JANET_FILE_CLOSED;
|
iof->flags |= JANET_FILE_CLOSED;
|
||||||
return janet_wrap_nil();
|
return janet_wrap_nil();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user