/*module->handle = garbage */
module->psz_filename = NULL;
module->domain = NULL;
- module->b_builtin = false;
module->b_loaded = false;
return module;
}
submodule->psz_help = NULL;
submodule->psz_capability = NULL;
submodule->i_score = module->i_score;
- submodule->b_builtin = false;
submodule->b_loaded = false;
submodule->b_unloadable = false;
submodule->pf_activate = NULL;
/* Make sure the module is loaded in mem */
module_t *p_real = p_cand->parent ? p_cand->parent : p_cand;
- if( !p_real->b_builtin && !p_real->b_loaded )
+ if (!p_real->b_loaded)
{
+ assert (p_real->psz_filename != NULL);
+
module_t *p_new_module =
AllocatePlugin( p_this, p_real->psz_filename, false );
if( p_new_module == NULL )
assert( p_module->next == NULL );
/* Unload plugin until we really need it */
- assert( !p_module->b_builtin );
if( p_module->b_loaded && p_module->b_unloadable )
{
module_Unload( p_module->handle );
return NULL;
}
- p_module->psz_filename = strdup( psz_file );
+ p_module->psz_filename = strdup (psz_file);
+ if (unlikely(p_module->psz_filename == NULL))
+ goto error;
p_module->handle = handle;
p_module->b_loaded = true;
msg_Err( p_this, "cannot initialize plugin `%s'", psz_file );
goto error;
}
-
- assert( !p_module->b_builtin );
return p_module;
error:
free( p_module->psz_filename );
if (entry (module))
assert (0);
- module->b_builtin = true;
module->b_loaded = true;
module->b_unloadable = false;
/* We free the structures that we strdup()ed in Allocate*Module(). */
#ifdef HAVE_DYNAMIC_PLUGINS
- if( !p_module->b_builtin )
- {
- if( p_module->b_loaded && p_module->b_unloadable )
- {
- module_Unload( p_module->handle );
- }
- free( p_module->psz_filename );
- }
+ 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 */