Commit eccbdf8f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Destroy submodules from vlc_module_destroy()

Again, this should help fix leaks in error paths.
parent cefb8d38
......@@ -73,6 +73,14 @@ module_t *vlc_module_create (void)
void vlc_module_destroy (module_t *module)
{
for (module_t *m = module->submodule, *next; m != NULL; m = next)
{
next = m->next;
vlc_module_destroy (m);
}
free (module->domain);
free (module->psz_filename);
for (unsigned i = 0; i < module->i_shortcuts; i++)
free (module->pp_shortcuts[i]);
free (module->pp_shortcuts);
......
......@@ -1050,6 +1050,7 @@ static module_t *module_InitStatic (vlc_plugin_cb entry)
static void DeleteModule (module_t **head, module_t *p_module)
{
assert( p_module );
assert (p_module->parent == NULL);
/* Unlist the module (if it is in the list) */
module_t **pp_self = head;
......@@ -1062,17 +1063,8 @@ static void DeleteModule (module_t **head, module_t *p_module)
#ifdef HAVE_DYNAMIC_PLUGINS
if (p_module->b_loaded && p_module->b_unloadable)
module_Unload (p_module->handle);
free (p_module->psz_filename);
#endif
/* Free and detach the object's children */
while (p_module->submodule)
{
module_t *submodule = p_module->submodule;
p_module->submodule = submodule->next;
vlc_module_destroy (submodule);
}
config_Free( p_module );
vlc_module_destroy (p_module);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment