diff options
author | Reuben Thomas <rrt@sc3d.org> | 2019-09-11 14:20:18 +0100 |
---|---|---|
committer | Reuben Thomas <rrt@sc3d.org> | 2019-09-11 14:20:18 +0100 |
commit | 8465d3391f35f88a4a528588bd87604b475f5365 (patch) | |
tree | a93f1dabbabca95b4966623c66c7071b6cabd27e /tests | |
parent | cf2f45d8de73310aa50a9d0fca967ed7839e38c4 (diff) | |
download | enchant-8465d3391f35f88a4a528588bd87604b475f5365.tar.gz |
Tests: fix some memory leaks (thanks, ASAN!)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/EnchantTestFixture.h | 1 | ||||
-rw-r--r-- | tests/enchant_providers/Dictionary/dictionary_check.cpp | 4 | ||||
-rw-r--r-- | tests/main.test.cpp | 3 |
3 files changed, 6 insertions, 2 deletions
diff --git a/tests/EnchantTestFixture.h b/tests/EnchantTestFixture.h index 9168ce1..23492cb 100644 --- a/tests/EnchantTestFixture.h +++ b/tests/EnchantTestFixture.h @@ -44,7 +44,6 @@ struct EnchantTestFixture //Setup
EnchantTestFixture()
{
- enchant_set_prefix_dir(".");
CleanUpFiles(); //just in case we stopped the process in the middle.
CreateDirectory(GetTempUserEnchantDir());
}
diff --git a/tests/enchant_providers/Dictionary/dictionary_check.cpp b/tests/enchant_providers/Dictionary/dictionary_check.cpp index 3268498..754beee 100644 --- a/tests/enchant_providers/Dictionary/dictionary_check.cpp +++ b/tests/enchant_providers/Dictionary/dictionary_check.cpp @@ -40,8 +40,10 @@ struct DictionaryCheck_TestFixture : Provider_TestFixture /* FIXME: hspell does not consider non-Hebrew letters to be valid letters */
if (_dict) {
_provider_name = _provider->identify(_provider);
- if (strcmp(_provider_name, "hspell") == 0)
+ if (strcmp(_provider_name, "hspell") == 0) {
+ ReleaseDictionary(_dict);
_dict = NULL;
+ }
}
}
diff --git a/tests/main.test.cpp b/tests/main.test.cpp index dcd4349..2b41ff7 100644 --- a/tests/main.test.cpp +++ b/tests/main.test.cpp @@ -21,11 +21,14 @@ #include <UnitTest++/UnitTest++.h>
#include "EnchantBrokerTestFixture.h"
+#include "enchant.h"
+
EnchantProvider * EnchantBrokerTestFixture::mock_provider=NULL;
ConfigureHook EnchantBrokerTestFixture::userMockProviderConfiguration=NULL;
ConfigureHook EnchantBrokerTestFixture::userMockProvider2Configuration=NULL;
int main(){
+ enchant_set_prefix_dir(".");
return UnitTest::RunAllTests();
}
|