aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2024-08-19 16:14:55 +0200
committerMike Pall <mike>2024-08-19 16:14:55 +0200
commit5ca25ee83ec1b0343556cd5783ade449676b4037 (patch)
tree1906d4e7a96d450ba4c856ba8896f99883b584ae
parent19db4e9b7c5e19398286adb4d953a4874cc39ae0 (diff)
downloadluajit-5ca25ee83ec1b0343556cd5783ade449676b4037.tar.gz
luajit-5ca25ee83ec1b0343556cd5783ade449676b4037.tar.bz2
luajit-5ca25ee83ec1b0343556cd5783ade449676b4037.zip
Correctly close VM state after early OOM during open.
Reported by Assumeru. #1248
-rw-r--r--src/lj_gc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c
index 9c0d6797..25374d03 100644
--- a/src/lj_gc.c
+++ b/src/lj_gc.c
@@ -564,12 +564,11 @@ void lj_gc_finalize_cdata(lua_State *L)
564/* Free all remaining GC objects. */ 564/* Free all remaining GC objects. */
565void lj_gc_freeall(global_State *g) 565void lj_gc_freeall(global_State *g)
566{ 566{
567 MSize i, strmask; 567 MSize i;
568 /* Free everything, except super-fixed objects (the main thread). */ 568 /* Free everything, except super-fixed objects (the main thread). */
569 g->gc.currentwhite = LJ_GC_WHITES | LJ_GC_SFIXED; 569 g->gc.currentwhite = LJ_GC_WHITES | LJ_GC_SFIXED;
570 gc_fullsweep(g, &g->gc.root); 570 gc_fullsweep(g, &g->gc.root);
571 strmask = g->strmask; 571 for (i = g->strmask; i != ~(MSize)0; i--) /* Free all string hash chains. */
572 for (i = 0; i <= strmask; i++) /* Free all string hash chains. */
573 gc_fullsweep(g, &g->strhash[i]); 572 gc_fullsweep(g, &g->strhash[i]);
574} 573}
575 574