Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3967

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/67/3967/1

Fix memory leak in mapToFontConfigLangTag.

FcGetLangs() will return a new FCStrSet that needs to be freed after usage.

Change-Id: Ie7fe0dd160fa59077d6a90878e70d0e034680812
---
M vcl/generic/fontmanager/fontconfig.cxx
1 file changed, 12 insertions(+), 0 deletions(-)



diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx
index dc8dfa7..3e23fc9 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -811,11 +811,17 @@
 
         sLangAttrib = OUStringToOString(rLangTag.getBcp47(), 
RTL_TEXTENCODING_UTF8).toAsciiLowerCase();
         if (FcStrSetMember(pLangSet, (const FcChar8*)sLangAttrib.getStr()))
+        {
+            FcStrSetDestroy(pLangSet);
             return sLangAttrib;
+        }
 
         sLangAttrib = OUStringToOString(rLangTag.getLanguageAndScript(), 
RTL_TEXTENCODING_UTF8).toAsciiLowerCase();
         if (FcStrSetMember(pLangSet, (const FcChar8*)sLangAttrib.getStr()))
+        {
+            FcStrSetDestroy(pLangSet);
             return sLangAttrib;
+        }
 
         OString sLang = OUStringToOString(rLangTag.getLanguage(), 
RTL_TEXTENCODING_UTF8).toAsciiLowerCase();
         OString sRegion = OUStringToOString(rLangTag.getCountry(), 
RTL_TEXTENCODING_UTF8).toAsciiLowerCase();
@@ -824,11 +830,17 @@
         {
             sLangAttrib = sLang + OString('-') + sRegion;
             if (FcStrSetMember(pLangSet, (const FcChar8*)sLangAttrib.getStr()))
+            {
+                FcStrSetDestroy(pLangSet);
                 return sLangAttrib;
+            }
         }
 
         if (FcStrSetMember(pLangSet, (const FcChar8*)sLang.getStr()))
+        {
+            FcStrSetDestroy(pLangSet);
             return sLang;
+        }
 
         return OString();
 #else

-- 
To view, visit https://gerrit.libreoffice.org/3967
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7fe0dd160fa59077d6a90878e70d0e034680812
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Mark Wielaard <mark@klomp.org>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.