diff --git a/src/fcinit.c b/src/fcinit.c index db62c21..8375e94 100644 --- a/src/fcinit.c +++ b/src/fcinit.c @@ -180,6 +180,8 @@ FcFini (void) FcConfigFini (); FcCacheFini (); FcDefaultFini (); + FcObjectOtherTypeFini (); + FcIncludeFini (); } /* diff --git a/src/fcint.h b/src/fcint.h index 45dfc6e..cba9dbe 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -880,6 +880,7 @@ FcPrivate FcConfig * FcInitLoadOwnConfigAndFonts (FcConfig *config); /* fcxml.c */ +void FcIncludeFini(void); FcPrivate void FcTestDestroy (FcTest *test); @@ -1192,6 +1193,7 @@ FcStrSerialize (FcSerialize *serialize, const FcChar8 *str); /* fcobjs.c */ +void FcObjectOtherTypeFini(void); FcPrivate FcObject FcObjectLookupIdByName (const char *str); diff --git a/src/fcobjs.c b/src/fcobjs.c index bad9824..cce6e8d 100644 --- a/src/fcobjs.c +++ b/src/fcobjs.c @@ -44,6 +44,26 @@ struct FcObjectOtherTypeInfo { FcObject id; } *other_types; +void FcObjectOtherTypeFini(void) +{ + struct FcObjectOtherTypeInfo *ots, *ot; + ots = fc_atomic_ptr_get (&other_types); + ot = ots->next; + while(ot){ + ots->next = ot->next; + if (ot->object.object) { + free(ot->object.object); + } + free(ot); + ot = ots->next; + } + if (ots->object.object) { + free(ots->object.object); + } + free(ots); + ots = NULL; +} + static FcObjectType * _FcObjectLookupOtherTypeByName (const char *str, FcObject *id) { @@ -68,7 +88,11 @@ retry: ot->next = ots; if (!fc_atomic_ptr_cmpexch (&other_types, ots, ot)) { + if (ot->object.object) { + FcStrFree (ot->object.object); + } free (ot); + fc_atomic_int_add (next_id, -1); goto retry; } } diff --git a/src/fcxml.c b/src/fcxml.c index 29dd4d6..d64abda 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -2243,6 +2243,21 @@ FcParseCacheDir (FcConfigParse *parse) FcStrFree (data); } +static FcChar8 *userdir = NULL; +static FcChar8 *userconf = NULL; + +void FcIncludeFini(void) +{ + if (userconf) { + FcStrFree(userconf); + userconf = NULL; + } + if(userdir){ + FcStrFree(userdir); + userdir = NULL; + } +} + static void FcParseInclude (FcConfigParse *parse) { @@ -2251,8 +2266,8 @@ FcParseInclude (FcConfigParse *parse) FcBool ignore_missing = FcFalse; FcBool deprecated = FcFalse; FcChar8 *prefix = NULL, *p; - static FcChar8 *userdir = NULL; - static FcChar8 *userconf = NULL; + /* static FcChar8 *userdir = NULL; */ + /* static FcChar8 *userconf = NULL; */ s = FcStrBufDoneStatic (&parse->pstack->str); if (!s)