Free up plugin info structs after converting to plugin containers.
This commit is contained in:
@@ -270,11 +270,24 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Zero out info strings that we now own (see above). */
|
||||||
|
info->symbol_name = NULL;
|
||||||
|
info->options = NULL;
|
||||||
|
|
||||||
rval = true;
|
rval = true;
|
||||||
done:
|
done:
|
||||||
debug_return_bool(rval);
|
debug_return_bool(rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
free_plugin_info(struct plugin_info *info)
|
||||||
|
{
|
||||||
|
sudo_efree(info->path);
|
||||||
|
sudo_efree(info->options);
|
||||||
|
sudo_efree(info->symbol_name);
|
||||||
|
sudo_efree(info);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load the plugins listed in sudo.conf.
|
* Load the plugins listed in sudo.conf.
|
||||||
*/
|
*/
|
||||||
@@ -284,17 +297,19 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
|
|||||||
{
|
{
|
||||||
struct plugin_container *container;
|
struct plugin_container *container;
|
||||||
struct plugin_info_list *plugins;
|
struct plugin_info_list *plugins;
|
||||||
struct plugin_info *info;
|
struct plugin_info *info, *next;
|
||||||
bool rval = false;
|
bool rval = false;
|
||||||
debug_decl(sudo_load_plugins, SUDO_DEBUG_PLUGIN, sudo_debug_instance)
|
debug_decl(sudo_load_plugins, SUDO_DEBUG_PLUGIN, sudo_debug_instance)
|
||||||
|
|
||||||
/* Walk the plugin list from sudo.conf, if any. */
|
/* Walk the plugin list from sudo.conf, if any and free it. */
|
||||||
plugins = sudo_conf_plugins();
|
plugins = sudo_conf_plugins();
|
||||||
TAILQ_FOREACH(info, plugins, entries) {
|
TAILQ_FOREACH_SAFE(info, plugins, entries, next) {
|
||||||
rval = sudo_load_plugin(policy_plugin, io_plugins, info);
|
rval = sudo_load_plugin(policy_plugin, io_plugins, info);
|
||||||
if (!rval)
|
if (!rval)
|
||||||
goto done;
|
goto done;
|
||||||
|
free_plugin_info(info);
|
||||||
}
|
}
|
||||||
|
TAILQ_INIT(plugins);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If no policy plugin, fall back to the default (sudoers).
|
* If no policy plugin, fall back to the default (sudoers).
|
||||||
|
Reference in New Issue
Block a user