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

Clean up config_Free()

parent 03cf0f14
...@@ -30,7 +30,7 @@ extern "C" { ...@@ -30,7 +30,7 @@ extern "C" {
int config_CreateDir( vlc_object_t *, const char * ); int config_CreateDir( vlc_object_t *, const char * );
int config_AutoSaveConfigFile( vlc_object_t * ); int config_AutoSaveConfigFile( vlc_object_t * );
void config_Free( module_t * ); void config_Free (module_config_t *, size_t);
int config_LoadCmdLine ( vlc_object_t *, int, const char *[], int * ); int config_LoadCmdLine ( vlc_object_t *, int, const char *[], int * );
int config_LoadConfigFile( vlc_object_t * ); int config_LoadConfigFile( vlc_object_t * );
......
...@@ -420,18 +420,16 @@ module_config_t *config_FindConfig (vlc_object_t *p_this, const char *name) ...@@ -420,18 +420,16 @@ module_config_t *config_FindConfig (vlc_object_t *p_this, const char *name)
return p ? *p : NULL; return p ? *p : NULL;
} }
/***************************************************************************** /**
* config_Free: frees a duplicated module's configuration data. * Destroys an array of configuration items.
***************************************************************************** * \param config start of array of items
* This function frees all the data duplicated by config_Duplicate. * \param confsize number of items in the array
*****************************************************************************/ */
void config_Free( module_t *p_module ) void config_Free (module_config_t *config, size_t confsize)
{ {
int i; for (size_t j = 0; j < confsize; j++)
for (size_t j = 0; j < p_module->confsize; j++)
{ {
module_config_t *p_item = p_module->p_config + j; module_config_t *p_item = config + j;
free( p_item->psz_type ); free( p_item->psz_type );
free( p_item->psz_name ); free( p_item->psz_name );
...@@ -446,10 +444,10 @@ void config_Free( module_t *p_module ) ...@@ -446,10 +444,10 @@ void config_Free( module_t *p_module )
} }
if( p_item->ppsz_list ) if( p_item->ppsz_list )
for( i = 0; i < p_item->i_list; i++ ) for (int i = 0; i < p_item->i_list; i++)
free( p_item->ppsz_list[i] ); free( p_item->ppsz_list[i] );
if( p_item->ppsz_list_text ) if( p_item->ppsz_list_text )
for( i = 0; i < p_item->i_list; i++ ) for (int i = 0; i < p_item->i_list; i++)
free( p_item->ppsz_list_text[i] ); free( p_item->ppsz_list_text[i] );
free( p_item->ppsz_list ); free( p_item->ppsz_list );
free( p_item->ppsz_list_text ); free( p_item->ppsz_list_text );
...@@ -457,17 +455,14 @@ void config_Free( module_t *p_module ) ...@@ -457,17 +455,14 @@ void config_Free( module_t *p_module )
if( p_item->i_action ) if( p_item->i_action )
{ {
for( i = 0; i < p_item->i_action; i++ ) for (int i = 0; i < p_item->i_action; i++)
{
free( p_item->ppsz_action_text[i] ); free( p_item->ppsz_action_text[i] );
}
free( p_item->ppf_action ); free( p_item->ppf_action );
free( p_item->ppsz_action_text ); free( p_item->ppsz_action_text );
} }
} }
free (p_module->p_config); free (config);
p_module->p_config = NULL;
} }
#undef config_ResetAll #undef config_ResetAll
......
...@@ -91,6 +91,8 @@ void vlc_module_destroy (module_t *module) ...@@ -91,6 +91,8 @@ void vlc_module_destroy (module_t *module)
vlc_module_destroy (m); vlc_module_destroy (m);
} }
config_Free (module->p_config, module->confsize);
free (module->domain); free (module->domain);
free (module->psz_filename); free (module->psz_filename);
for (unsigned i = 0; i < module->i_shortcuts; i++) for (unsigned i = 0; i < module->i_shortcuts; i++)
......
...@@ -1053,7 +1053,5 @@ static void DeleteModule (module_t **head, module_t *p_module) ...@@ -1053,7 +1053,5 @@ static void DeleteModule (module_t **head, module_t *p_module)
if (p_module->b_loaded && p_module->b_unloadable) if (p_module->b_loaded && p_module->b_unloadable)
module_Unload (p_module->handle); module_Unload (p_module->handle);
#endif #endif
config_Free( p_module );
vlc_module_destroy (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