This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637)
- From: Sylvestre Ledru <sylvestre at debian dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 14 May 2017 11:59:40 +0200
- Subject: [PATCH] plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637)
- Authentication-results: sourceware.org; auth=none
Add missing dlclose()
S
>From d0926b84047f281a29dc51bbd0a4bdda01a5c63f Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <sylvestre@debian.org>
Date: Sun, 14 May 2017 11:28:38 +0200
Subject: [PATCH 4/5] 2017-05-14 Sylvestre Ledru <sylvestre@debian.org>
* plugin.c (try_init_one_plugin): Fix ressource leaks (CID 726637)
---
gcc/plugin.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/plugin.c b/gcc/plugin.c
index cfd6ef25036..903a197b78b 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;
}
+ dlclose(dl_handle);
return true;
}
--
2.11.0