aboutsummaryrefslogtreecommitdiff
path: root/gcc/plugin.c
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre@debian.org>2017-05-16 07:44:33 +0000
committerSylvestre Ledru <sylvestre@gcc.gnu.org>2017-05-16 07:44:33 +0000
commit3fc5147b9ba44ff5b8567d6c71b184cbe9595a96 (patch)
tree9c97903dc7e2bbf5cbd3fda824bff7b244cc176c /gcc/plugin.c
parentbe742f1ebefc631d30c3711ada16f5fe5d3b9bac (diff)
downloadgcc-3fc5147b9ba44ff5b8567d6c71b184cbe9595a96.zip
gcc-3fc5147b9ba44ff5b8567d6c71b184cbe9595a96.tar.gz
gcc-3fc5147b9ba44ff5b8567d6c71b184cbe9595a96.tar.bz2
plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637)
From-SVN: r248088
Diffstat (limited to 'gcc/plugin.c')
-rw-r--r--gcc/plugin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/plugin.c b/gcc/plugin.c
index cfd6ef2..c6d3cdd 100644
--- a/gcc/plugin.c
+++ b/gcc/plugin.c
@@ -617,6 +617,7 @@ try_init_one_plugin (struct plugin_name_args *plugin)
if ((err = dlerror ()) != NULL)
{
+ dlclose(dl_handle);
error ("cannot find %s in plugin %s\n%s", str_plugin_init_func_name,
plugin->full_name, err);
return false;
@@ -625,10 +626,12 @@ try_init_one_plugin (struct plugin_name_args *plugin)
/* Call the plugin-provided initialization routine with the arguments. */
if ((*plugin_init) (plugin, &gcc_version))
{
+ dlclose(dl_handle);
error ("fail to initialize plugin %s", plugin->full_name);
return false;
}
-
+ /* leak dl_handle on purpose to ensure the plugin is loaded for the
+ entire run of the compiler. */
return true;
}