[Issue#] #17499
[Problem] Shared library opened with dlopen() but not closed.
[Cause] N/A
[Solution] Close the library with dlclose()
[SCMRequest] N/A
[Verification] Build repository.
Change-Id: Iea83e537f3fbff0682b2ca4b4b886088090b11e6
#include <algorithm>
#include <dpl/log/log.h>
#include <algorithm>
#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
+#include <dpl/scope_guard.h>
namespace WrtPluginsApi {
void PluginRegistry::AddPlugin(const std::string& libraryName,
namespace WrtPluginsApi {
void PluginRegistry::AddPlugin(const std::string& libraryName,
LogError("Error: " << (error != NULL ? error : "unknown"));
continue;
}
LogError("Error: " << (error != NULL ? error : "unknown"));
continue;
}
+ DPL_SCOPE_EXIT(handle) {
+ if (dlclose(handle) != 0) {
+ const char* error = dlerror();
+ if (error != NULL)
+ {
+ std::string errstr{error};
+ _E("%s", errstr.c_str());
+ }
+ else
+ {
+ _E("unknown error while closing plug-in library");
+ }
+ }
+ };
ExportedApi* entryPoint =
static_cast<ExportedApi*>
ExportedApi* entryPoint =
static_cast<ExportedApi*>