]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccache.c
Add ref counting to font config patterns so that FcFontSort return values
[fontconfig.git] / src / fccache.c
index ec831043c45d07e1cd5f2699cde6b9d6417c0606..960beb4218923bc87c36e2b644f112e1013e76b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: xc/lib/fontconfig/src/fccache.c,v 1.4 2002/03/01 01:00:54 keithp Exp $
+ * $XFree86: xc/lib/fontconfig/src/fccache.c,v 1.7 2002/05/21 17:06:22 keithp Exp $
  *
  * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -594,9 +594,16 @@ FcFileCacheReadDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *cache_file)
                {
                    printf (" dir cache file \"%s\"\n", file);
                }
-               FcPatternAddString (font, FC_FILE, path);
+               if (!FcPatternAddString (font, FC_FILE, path))
+               {
+                   FcPatternDestroy (font);
+                   goto bail2;
+               }
                if (!FcFontSetAdd (set, font))
+               {
+                   FcPatternDestroy (font);
                    goto bail2;
+               }
            }
        }
        if (path != path_buf)