From 871164d217159407a74f558de2eefff213e0ce83 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Mon, 11 Jan 2021 21:45:34 +0900 Subject: [PATCH] Fix gc loss in os.environ --- src/os.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/os.c b/src/os.c index 38e201d..0ecc5c0 100644 --- a/src/os.c +++ b/src/os.c @@ -65,12 +65,14 @@ static void _loadEnviron(KrkInstance * module) { /* Start with an empty dictionary */ KrkInstance * environObj = AS_INSTANCE(krk_dict_of(0,NULL)); + krk_push(OBJECT_VAL(environObj)); /* Transform it into an _Environ */ environObj->_class = environClass; /* And attach it to the module */ krk_attachNamedObject(&module->fields, "environ", (KrkObj*)environObj); + krk_pop(); /* Now load the environment into it */ if (!environ) return; /* Empty environment */