fix: nullify module slots after unload

* Set all module slot fields (handle, init, shutdown, id) to NULL/empty
after unloading to prevent use-after-free and enable proper hole
detection during array defragmentation.
This commit is contained in:
2026-01-28 00:18:29 +01:00
parent 2823c8ab59
commit 91ec40d5b1
+4
View File
@@ -149,6 +149,10 @@ void stk_module_unload(size_t index)
{ {
stk_shutdowns[index](); stk_shutdowns[index]();
platform_unload_library(stk_handles[index]); platform_unload_library(stk_handles[index]);
stk_handles[index] = NULL;
stk_inits[index] = NULL;
stk_shutdowns[index] = NULL;
stk_module_ids[index][0] = '\0';
} }
void stk_module_free_memory(void) void stk_module_free_memory(void)