aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fclang.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-12-10 08:33:13 +0100
committermarha <marha@users.sourceforge.net>2012-12-10 08:33:13 +0100
commit0328076efb5ff6e62152c09e38d0d11f7931d07b (patch)
treece71cf0fe95186671dc75862c2ced47f4735214f /fontconfig/src/fclang.c
parente82692e521240c5f8592f9ce56c9d5b3d68870ec (diff)
downloadvcxsrv-0328076efb5ff6e62152c09e38d0d11f7931d07b.tar.gz
vcxsrv-0328076efb5ff6e62152c09e38d0d11f7931d07b.tar.bz2
vcxsrv-0328076efb5ff6e62152c09e38d0d11f7931d07b.zip
fontconfig libX11 mesa pixman git update 10 dec 2012
libX11 9833489e6c3829a1e835bc0a11f028fc180809e4 mesa 17f5dc57306b8f5079304701e455bf4b927d3cae pixman 8ca4e144724ba2041bc5ef077ccf6d24e7cf4d1f fontconfig 608c5b590bd3428dfcd30f3d68ee8b7131e2f019
Diffstat (limited to 'fontconfig/src/fclang.c')
-rw-r--r--fontconfig/src/fclang.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/fontconfig/src/fclang.c b/fontconfig/src/fclang.c
index b7e70fcfb..65d22a932 100644
--- a/fontconfig/src/fclang.c
+++ b/fontconfig/src/fclang.c
@@ -182,7 +182,7 @@ FcLangNormalize (const FcChar8 *lang)
{
FcChar8 *result = NULL, *s, *orig;
char *territory, *encoding, *modifier;
- size_t llen, tlen = 0, mlen = 0;
+ size_t llen, tlen = 0, mlen = 0, ssize;
if (!lang || !*lang)
return NULL;
@@ -197,6 +197,10 @@ FcLangNormalize (const FcChar8 *lang)
s = FcStrCopy (lang);
if (!s)
goto bail;
+ /* store the original length of 's' here to let FcMemFree know
+ * the correct size since we breaks 's' from now on.
+ */
+ ssize = strlen ((const char *)s) + 1;
/* from the comments in glibc:
*
@@ -282,6 +286,11 @@ FcLangNormalize (const FcChar8 *lang)
else
{
result = s;
+ /* we'll miss the opportunity to reduce the correct size
+ * of the allocated memory for the string after that.
+ */
+ FcMemFree (FC_MEM_STRING, ssize);
+ FcMemAlloc (FC_MEM_STRING, strlen((const char *)s) + 1);
s = NULL;
goto bail1;
}
@@ -295,6 +304,11 @@ FcLangNormalize (const FcChar8 *lang)
else
{
result = s;
+ /* we'll miss the opportunity to reduce the correct size
+ * of the allocated memory for the string after that.
+ */
+ FcMemFree (FC_MEM_STRING, ssize);
+ FcMemAlloc (FC_MEM_STRING, strlen((const char *)s) + 1);
s = NULL;
goto bail1;
}
@@ -312,14 +326,22 @@ FcLangNormalize (const FcChar8 *lang)
else
{
result = s;
+ /* we'll miss the opportunity to reduce the correct size
+ * of the allocated memory for the string after that.
+ */
+ FcMemFree (FC_MEM_STRING, ssize);
+ FcMemAlloc (FC_MEM_STRING, strlen((const char *)s) + 1);
s = NULL;
}
bail1:
if (orig)
- free (orig);
+ FcStrFree (orig);
bail0:
if (s)
+ {
free (s);
+ FcMemFree (FC_MEM_STRING, ssize);
+ }
bail:
if (FcDebug () & FC_DBG_LANGSET)
{