aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/core/GpgCoreTest.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2023-12-14 12:39:48 +0000
committersaturneric <[email protected]>2023-12-14 12:39:48 +0000
commitbeafe53c1b8671d8e84f0546eb404597300448c7 (patch)
treef9b3e2d1f1c94c344fe3f9df919f4be2e56b4cae /src/test/core/GpgCoreTest.cpp
parentfix: slove some memory issues (diff)
downloadGpgFrontend-beafe53c1b8671d8e84f0546eb404597300448c7.tar.gz
GpgFrontend-beafe53c1b8671d8e84f0546eb404597300448c7.zip
fix: slove issues on memory and add asan support for debug
Diffstat (limited to 'src/test/core/GpgCoreTest.cpp')
-rw-r--r--src/test/core/GpgCoreTest.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/test/core/GpgCoreTest.cpp b/src/test/core/GpgCoreTest.cpp
index f2616573..ecba016f 100644
--- a/src/test/core/GpgCoreTest.cpp
+++ b/src/test/core/GpgCoreTest.cpp
@@ -30,6 +30,7 @@
#include "core/function/gpg/GpgKeyImportExporter.h"
#include "core/utils/IOUtils.h"
+#include "core/utils/MemoryUtils.h"
#include "spdlog/spdlog.h"
namespace GpgFrontend::Test {
@@ -43,9 +44,9 @@ void GpgCoreTest::import_private_keys(const libconfig::Setting& root) {
private_key.lookupValue("filename", filename);
auto data_file_path = data_path_ / filename;
std::string data = ReadAllDataInFile(data_file_path.string());
- auto secret_key_copy = std::make_unique<std::string>(data);
+ auto secret_key_copy = SecureCreateSharedObject<std::string>(data);
GpgKeyImportExporter::GetInstance(kGpgFrontendDefaultChannel)
- .ImportKey(std::move(secret_key_copy));
+ .ImportKey(secret_key_copy);
}
}
}