[Spice-devel] [spice-streaming-agent PATCH 2/2] LoadPlugin: call dlclose upon failure

Uri Lublin uril at redhat.com
Wed Aug 1 12:43:37 UTC 2018


Signed-off-by: Uri Lublin <uril at redhat.com>
---
 src/concrete-agent.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/concrete-agent.cpp b/src/concrete-agent.cpp
index ca666d7..f26b23c 100644
--- a/src/concrete-agent.cpp
+++ b/src/concrete-agent.cpp
@@ -80,6 +80,7 @@ void ConcreteAgent::LoadPlugin(const std::string &plugin_filename)
     if (!dl) {
         syslog(LOG_ERR, "error loading plugin %s: %s",
                plugin_filename.c_str(), dlerror());
+        dlclose(dl);
         return;
     }
 
@@ -88,6 +89,7 @@ void ConcreteAgent::LoadPlugin(const std::string &plugin_filename)
     if (!version) {
         syslog(LOG_ERR, "error loading plugin %s: no version information",
                plugin_filename.c_str());
+        dlclose(dl);
         return;
     }
     if (!PluginVersionIsCompatible(*version)) {
@@ -95,6 +97,7 @@ void ConcreteAgent::LoadPlugin(const std::string &plugin_filename)
                "error loading plugin %s: plugin interface version %u.%u not accepted",
                plugin_filename.c_str(),
                MajorVersion(*version), MinorVersion(*version));
+        dlclose(dl);
         return;
     }
 
-- 
2.17.1



More information about the Spice-devel mailing list