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:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user