Commit 3fc5147b by Sylvestre Ledru Committed by Sylvestre Ledru

plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637)

From-SVN: r248088
parent be742f1e
2017-05-15 Sylvestre Ledru <sylvestre@debian.org>
plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637)
2017-05-15 Uros Bizjak <ubizjak@gmail.com> 2017-05-15 Uros Bizjak <ubizjak@gmail.com>
PR target/80425 PR target/80425
......
...@@ -617,6 +617,7 @@ try_init_one_plugin (struct plugin_name_args *plugin) ...@@ -617,6 +617,7 @@ try_init_one_plugin (struct plugin_name_args *plugin)
if ((err = dlerror ()) != NULL) if ((err = dlerror ()) != NULL)
{ {
dlclose(dl_handle);
error ("cannot find %s in plugin %s\n%s", str_plugin_init_func_name, error ("cannot find %s in plugin %s\n%s", str_plugin_init_func_name,
plugin->full_name, err); plugin->full_name, err);
return false; return false;
...@@ -625,10 +626,12 @@ try_init_one_plugin (struct plugin_name_args *plugin) ...@@ -625,10 +626,12 @@ try_init_one_plugin (struct plugin_name_args *plugin)
/* Call the plugin-provided initialization routine with the arguments. */ /* Call the plugin-provided initialization routine with the arguments. */
if ((*plugin_init) (plugin, &gcc_version)) if ((*plugin_init) (plugin, &gcc_version))
{ {
dlclose(dl_handle);
error ("fail to initialize plugin %s", plugin->full_name); error ("fail to initialize plugin %s", plugin->full_name);
return false; return false;
} }
/* leak dl_handle on purpose to ensure the plugin is loaded for the
entire run of the compiler. */
return true; return true;
} }
......
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