diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-05-20 20:37:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-21 14:01:16 +0100 |
commit | 1704b1200d39eba8e235ca5c13c5a931d07a98b3 (patch) | |
tree | 61446afdbab2e8c20b191e2c4958a20177a96679 /vcl/generic/fontmanager | |
parent | 6aa19bf090ac03fcb55479155abb0d59f43d766a (diff) |
absoletely guarantee there is no mem leak
Change-Id: If6960dea479bb8970cb94aa05a3c9d44bf60cfc5
Diffstat (limited to 'vcl/generic/fontmanager')
-rw-r--r-- | vcl/generic/fontmanager/fontconfig.cxx | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx index 3e23fc9f21d5..1b36980b9c46 100644 --- a/vcl/generic/fontmanager/fontconfig.cxx +++ b/vcl/generic/fontmanager/fontconfig.cxx @@ -806,20 +806,18 @@ namespace OString mapToFontConfigLangTag(const LanguageTag &rLangTag) { #if defined(FC_VERSION) && (FC_VERSION >= 20492) - FcStrSet *pLangSet = FcGetLangs(); + boost::shared_ptr<FcStrSet> xLangSet(FcGetLangs(), FcStrSetDestroy); OString sLangAttrib; sLangAttrib = OUStringToOString(rLangTag.getBcp47(), RTL_TEXTENCODING_UTF8).toAsciiLowerCase(); - if (FcStrSetMember(pLangSet, (const FcChar8*)sLangAttrib.getStr())) + if (FcStrSetMember(xLangSet.get(), (const FcChar8*)sLangAttrib.getStr())) { - FcStrSetDestroy(pLangSet); return sLangAttrib; } sLangAttrib = OUStringToOString(rLangTag.getLanguageAndScript(), RTL_TEXTENCODING_UTF8).toAsciiLowerCase(); - if (FcStrSetMember(pLangSet, (const FcChar8*)sLangAttrib.getStr())) + if (FcStrSetMember(xLangSet.get(), (const FcChar8*)sLangAttrib.getStr())) { - FcStrSetDestroy(pLangSet); return sLangAttrib; } @@ -829,16 +827,14 @@ namespace if (!sRegion.isEmpty()) { sLangAttrib = sLang + OString('-') + sRegion; - if (FcStrSetMember(pLangSet, (const FcChar8*)sLangAttrib.getStr())) + if (FcStrSetMember(xLangSet.get(), (const FcChar8*)sLangAttrib.getStr())) { - FcStrSetDestroy(pLangSet); return sLangAttrib; } } - if (FcStrSetMember(pLangSet, (const FcChar8*)sLang.getStr())) + if (FcStrSetMember(xLangSet.get(), (const FcChar8*)sLang.getStr())) { - FcStrSetDestroy(pLangSet); return sLang; } |