]> git.wh0rd.org Git - fontconfig.git/commitdiff
Fix warnings and embarrassing double-free error.
authorPatrick Lam <plam@MIT.EDU>
Thu, 3 Nov 2005 04:23:22 +0000 (04:23 +0000)
committerPatrick Lam <plam@MIT.EDU>
Thu, 3 Nov 2005 04:23:22 +0000 (04:23 +0000)
ChangeLog
src/fcfreetype.c
src/fcpat.c

index 6223c13015d0fd7220a4b8126a3f9a5f1c99852e..d4e3a887434512c223af2c705146c7ebad1b616e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-11-02  Patrick Lam  <plam@mit.edu>
+       * src/fcfreetype.c (FcFreetypeQuery):
+       * src/fcpat.c (FcPatternDestroy, FcPatternDuplicate, 
+                      FcPatternTransferFullFname):
+
+       Fix warnings and embarrassing double-free error.
+
 2005-11-02  Zhe Su  <zsu@novell.com>
        reviewed by: plam
        
index 98728363837a34fffeed5f8c02c8f2f71fc981fd..46dc5a41455b613c6bacd8fd620dc66fb5d8d79e 100644 (file)
@@ -1291,7 +1291,7 @@ FcFreeTypeQuery (const FcChar8    *file,
     if (!FcPatternAddString (pat, FC_FILE, (FcChar8 *)basename((char *)FcStrCopy(file))))
        goto bail1;
 
-    FcPatternAddFullFname (pat, (const char *)file);
+    FcPatternAddFullFname (pat, (const char *)FcStrCopy (file));
 
     if (!FcPatternAddInteger (pat, FC_INDEX, id))
        goto bail1;
index 4dc5e4b7bc15843e8d9c5d37012bae1258d2b2dc..295ed02bdb2719e493a67c41128007733986f730 100644 (file)
@@ -309,7 +309,7 @@ FcPatternDestroy (FcPattern *p)
 
     if (FcPatternFindFullFname (p))
     {
-       FcStrFree (FcPatternFindFullFname (p));
+       FcStrFree ((FcChar8 *)FcPatternFindFullFname (p));
        FcPatternAddFullFname (p, 0);
     }
 
@@ -1276,14 +1276,8 @@ FcPatternDuplicate (const FcPattern *orig)
                                FcValueCanonicalize(&FcValueListPtrU(l)->value),
                               FcTrue))
                goto bail1;
-
-       if (!strcmp ((char *)FcObjectPtrU((e + i)->object), FC_FILE))
-       {
-           FcChar8 * s;
-           FcPatternGetString (orig, FC_FILE, 0, &s);
-           FcPatternAddFullFname (new, FcPatternFindFullFname(orig));
-       }
     }
+    FcPatternTransferFullFname (orig, new);
 
     return new;
 
@@ -2003,5 +1997,7 @@ FcPatternTransferFullFname (const FcPattern *new, const FcPattern *orig)
 {
     FcChar8 * s;
     FcPatternGetString (orig, FC_FILE, 0, &s);
-    FcPatternAddFullFname (new, FcStrCopy (FcPatternFindFullFname(orig)));
+    FcPatternAddFullFname (new, 
+                          (char *)FcStrCopy 
+                          ((FcChar8 *)FcPatternFindFullFname(orig)));
 }