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

Uri Lublin uril at redhat.com
Wed Aug 1 16:04:15 UTC 2018


On 08/01/2018 03:43 PM, Uri Lublin wrote:
> 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);

I'll remove this part.
If dl is NULL (dlopen failed) no need to dlclose it.

>           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;
>       }
>   
> 



More information about the Spice-devel mailing list