summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-09-16 22:14:26 +0200
committerJulien Nabet <serval2412@yahoo.fr>2017-09-16 22:54:56 +0200
commit83288332f7ced698610739419989c464256f1c4d (patch)
tree1170222db096dc4b8413ef23aa52aa63333c8373
parent6c87ecfaafab362d2d95dbcd976ffb5ea957097e (diff)
tdf#112425: fix leak in MacSpellChecker
by using "autorelease" keyword with init vars Change-Id: I056282460b94f8052287f5ad29d26a4870cd06a5 Reviewed-on: https://gerrit.libreoffice.org/42361 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/macspellimp.mm7
1 files changed, 3 insertions, 4 deletions
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 033b87555cf8..51e82f1dd0fb 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -231,13 +231,12 @@ sal_Int16 MacSpellChecker::GetSpellFailure( const OUString &rWord, const Locale
{
aEnc = 0;
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- NSString* aNSStr = [[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(nWord.getStr()) length: nWord.getLength()];
- NSString* aLang = [[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(rLocale.Language.getStr()) length: rLocale.Language.getLength()];
+ NSString* aNSStr = [[[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(nWord.getStr()) length: nWord.getLength()]autorelease];
+ NSString* aLang = [[[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(rLocale.Language.getStr()) length: rLocale.Language.getLength()]autorelease];
if(rLocale.Country.getLength()>0)
{
- NSString* aCountry = [[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(rLocale.Country.getStr()) length: rLocale.Country.getLength()];
+ NSString* aCountry = [[[NSString alloc] initWithCharacters: reinterpret_cast<unichar const *>(rLocale.Country.getStr()) length: rLocale.Country.getLength()]autorelease];
NSString* aTaggedCountry = [@"_" stringByAppendingString:aCountry];
- [aLang autorelease];
aLang = [aLang stringByAppendingString:aTaggedCountry];
}