]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcfreetype.c
Fix memory leaks in fc-cache directory cleaning code.
[fontconfig.git] / src / fcfreetype.c
index 2689b9f2c63fb196c09db30dc2f2716951116738..2cab48aa181502aa63f65cdaab9633c6bc889578 100644 (file)
   THE SOFTWARE.
 */
 
+#include "fcint.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "fcint.h"
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include FT_TRUETYPE_TABLES_H
@@ -554,8 +554,7 @@ FcFontCapabilities(FT_Face face);
 
 #define NUM_FC_MAC_ROMAN_FAKE  (int) (sizeof (fcMacRomanFake) / sizeof (fcMacRomanFake[0]))
 
-#if HAVE_ICONV && HAVE_ICONV_H
-#define USE_ICONV 1
+#if USE_ICONV
 #include <iconv.h>
 #endif
 
@@ -998,7 +997,6 @@ FcFreeTypeQuery (const FcChar8      *file,
     FcChar8        *family = 0;
 #endif
     FcChar8        *complex;
-    FcChar8        *file2;
     const FcChar8   *foundry = 0;
     int                    spacing;
     TT_OS2         *os2;
@@ -1279,15 +1277,8 @@ FcFreeTypeQuery (const FcChar8   *file,
                printf ("Saving unique fullname %s\n", full);
     }
 
-    file2 = FcStrCopy (file);
-    if (!FcPatternAddString (pat, FC_FILE, FcStrBasename(file2)))
-    {
-       FcStrFree (file2);
+    if (!FcPatternAddString (pat, FC_FILE, file))
        goto bail1;
-    }
-    FcStrFree (file2);
-
-    FcPatternAddFullFname (pat, (const char *)FcStrCopy (file));
 
     if (!FcPatternAddInteger (pat, FC_INDEX, id))
        goto bail1;
@@ -2744,11 +2735,13 @@ GetScriptTags(FT_Face face, FT_ULong tabletag, FT_ULong **stags, FT_UShort *scri
     FT_Stream  stream = face->stream;
     FT_Error   error;
     FT_UShort          n, p;
-    FT_Memory  memory = stream->memory;
+    FT_Memory  memory;
 
     if ( !stream )
        return TT_Err_Invalid_Face_Handle;
 
+    memory = stream->memory;
+
     if (( error = ftglue_face_goto_table( face, tabletag, stream ) ))
        return error;
 
@@ -2795,13 +2788,10 @@ GetScriptTags(FT_Face face, FT_ULong tabletag, FT_ULong **stags, FT_UShort *scri
 
        cur_offset = ftglue_stream_pos( stream );
 
-       if ( ftglue_stream_seek( stream, new_offset ) )
-           goto Fail;
+       error = ftglue_stream_seek( stream, new_offset );
 
        if ( error == TT_Err_Ok )
            p++;
-       else if ( error != TTO_Err_Empty_Script )
-           goto Fail;
 
        (void)ftglue_stream_seek( stream, cur_offset );
     }