Browse Source

fix(CI): Fix memory leak in core_test

Causes false positives when running tests with ASAN

Backported from 9cd9da4a53
reviewable/pr6511/r1
Anthony Bilinski 4 years ago
parent
commit
7d9d5162e2
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 8
      test/core/core_test.cpp

8
test/core/core_test.cpp

@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
#include <QSignalSpy>
#include <src/persistence/settings.h>
#include <iostream>
#include <memory>
Q_DECLARE_METATYPE(QList<DhtServer>);
@ -85,7 +86,7 @@ private slots: @@ -85,7 +86,7 @@ private slots:
private:
/* Test Variables */
Core::ToxCoreErrors* err = nullptr;
MockSettings* settings;
std::unique_ptr<MockSettings> settings;
QByteArray savedata{};
ToxCorePtr test_core;
};
@ -97,7 +98,7 @@ namespace { @@ -97,7 +98,7 @@ namespace {
void TestCore::startup_without_proxy()
{
settings = new MockSettings();
settings = std::unique_ptr<MockSettings>(new MockSettings());
// No proxy
settings->setProxyAddr("");
@ -122,8 +123,7 @@ void TestCore::startup_without_proxy() @@ -122,8 +123,7 @@ void TestCore::startup_without_proxy()
void TestCore::startup_with_invalid_proxy()
{
settings = new MockSettings();
settings = std::unique_ptr<MockSettings>(new MockSettings());
// Test invalid proxy SOCKS5
settings->setProxyAddr("Test");

Loading…
Cancel
Save