From: Sylvestre Ledru Date: Tue, 16 May 2017 07:44:33 +0000 (+0000) Subject: plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3fc5147b9ba44ff5b8567d6c71b184cbe9595a96;p=gcc.git plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637) From-SVN: r248088 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f94e442657f..48f1bee8e97 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2017-05-15 Sylvestre Ledru + + plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637) + 2017-05-15 Uros Bizjak PR target/80425 diff --git a/gcc/plugin.c b/gcc/plugin.c index cfd6ef25036..c6d3cddd810 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; }