aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-11-16 11:15:15 +0200
committerRiccardo Spagni <ric@spagni.net>2018-11-16 11:15:15 +0200
commitafaff5fb7715422816576e30a3ba42c1d0b14add (patch)
tree8ec7ba0e53b5542197cacc767744d27d3aea4d62 /tests/unit_tests
parentMerge pull request #4801 (diff)
parentunit_tests: fix leak when the test check fails (diff)
downloadmonero-afaff5fb7715422816576e30a3ba42c1d0b14add.tar.xz
Merge pull request #4803
fa3f756b unit_tests: fix leak when the test check fails (moneromooo-monero)
Diffstat (limited to 'tests/unit_tests')
-rw-r--r--tests/unit_tests/notify.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/unit_tests/notify.cpp b/tests/unit_tests/notify.cpp
index 4daeeddee..edc4eabdf 100644
--- a/tests/unit_tests/notify.cpp
+++ b/tests/unit_tests/notify.cpp
@@ -49,7 +49,8 @@ TEST(notify, works)
tmp = "/tmp";
static const char *filename = "monero-notify-unit-test-XXXXXX";
const size_t len = strlen(tmp) + 1 + strlen(filename);
- char *name_template = (char*)malloc(len + 1);
+ std::unique_ptr<char[]> name_template_((char*)malloc(len + 1));
+ char *name_template = name_template_.get();
ASSERT_TRUE(name_template != NULL);
snprintf(name_template, len + 1, "%s/%s", tmp, filename);
int fd = mkstemp(name_template);
@@ -75,5 +76,4 @@ TEST(notify, works)
ASSERT_TRUE(s == "1111111111111111111111111111111111111111111111111111111111111111");
boost::filesystem::remove(name_template);
- free(name_template);
}