fix: avoid memory leak

Related-To: NEO-9038
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-10-04 16:11:47 +00:00
committed by Compute-Runtime-Automation
parent 08e92d154f
commit 83c306e927
5 changed files with 17 additions and 16 deletions

View File

@@ -11,14 +11,14 @@
#include "os_pin.h"
#include <memory>
namespace NEO {
PinContext::OsLibraryLoadPtr PinContext::osLibraryLoadFunction(NEO::OsLibrary::load);
bool PinContext::init(const std::string &gtPinOpenFunctionName) {
NEO::OsLibrary *hGtPinLibrary = nullptr;
hGtPinLibrary = PinContext::osLibraryLoadFunction(PinContext::gtPinLibraryFilename.c_str());
auto hGtPinLibrary = std::unique_ptr<OsLibrary>(PinContext::osLibraryLoadFunction(PinContext::gtPinLibraryFilename.c_str()));
if (hGtPinLibrary == nullptr) {
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library %s\n", PinContext::gtPinLibraryFilename.c_str());