Commit 9dac3c59 authored by Keith Packard's avatar Keith Packard

More complete memory tracking. Install always overwrites header files

parent cb30af72
#
# $XFree86: xc/lib/fontconfig/fontconfig/Makefile.in,v 1.2 2002/05/24 06:25:52 keithp Exp $
# $XFree86: xc/lib/fontconfig/fontconfig/Makefile.in,v 1.3 2002/08/01 15:57:26 keithp Exp $
#
# Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
#
......@@ -29,20 +29,11 @@ include $(TOPDIR)/config/Makedefs
all::
install:: $(DESTDIR)$(INCLUDEDIR)
install:: $(DESTDIR)$(INCLUDEDIR)/fcfreetype.h
install:: $(DESTDIR)$(INCLUDEDIR)/fcprivate.h
install:: $(DESTDIR)$(INCLUDEDIR)/fontconfig.h
$(INSTALL_DATA) fcfreetype.h $(DESTDIR)$(INCLUDEDIR)/fcfreetype.h
$(INSTALL_DATA) fcprivate.h $(DESTDIR)$(INCLUDEDIR)/fcprivate.h
$(INSTALL_DATA) fontconfig.h $(DESTDIR)$(INCLUDEDIR)/fontconfig.h
$(DESTDIR)$(INCLUDEDIR):
mkdir -p $@
$(DESTDIR)$(INCLUDEDIR)/fcfreetype.h: fcfreetype.h
$(INSTALL_DATA) $< $(DESTDIR)$(INCLUDEDIR)/$<
$(DESTDIR)$(INCLUDEDIR)/fcprivate.h: fcprivate.h
$(INSTALL_DATA) $< $(DESTDIR)$(INCLUDEDIR)/$<
$(DESTDIR)$(INCLUDEDIR)/fontconfig.h: fontconfig.h
$(INSTALL_DATA) $< $(DESTDIR)$(INCLUDEDIR)/$<
clean::
/*
* $XFree86: xc/lib/fontconfig/src/fcatomic.c,v 1.1 2002/03/03 00:19:43 keithp Exp $
* $XFree86: xc/lib/fontconfig/src/fcatomic.c,v 1.2 2002/03/04 21:15:28 tsi Exp $
*
* Copyright 2002 Keith Packard, member of The XFree86 Project, Inc.
*
......@@ -70,6 +70,7 @@ FcAtomicCreate (const FcChar8 *file)
FcAtomic *atomic = malloc (total_len);
if (!atomic)
return 0;
FcMemAlloc (FC_MEM_ATOMIC, total_len);
atomic->file = (FcChar8 *) (atomic + 1);
strcpy ((char *) atomic->file, (char *) file);
......@@ -179,5 +180,10 @@ FcAtomicUnlock (FcAtomic *atomic)
void
FcAtomicDestroy (FcAtomic *atomic)
{
FcMemFree (FC_MEM_ATOMIC, sizeof (FcAtomic) +
strlen ((char *) atomic->file) * 4 + 1 +
sizeof (NEW_NAME) + sizeof (LCK_NAME) +
sizeof (TMP_NAME));
free (atomic);
}
......@@ -32,6 +32,7 @@ FcBlanksCreate (void)
b = malloc (sizeof (FcBlanks));
if (!b)
return 0;
FcMemAlloc (FC_MEM_BLANKS, sizeof (FcBlanks));
b->nblank = 0;
b->sblank = 0;
b->blanks = 0;
......@@ -42,7 +43,11 @@ void
FcBlanksDestroy (FcBlanks *b)
{
if (b->blanks)
{
FcMemFree (FC_MEM_BLANKS, b->sblank * sizeof (FcChar32));
free (b->blanks);
}
FcMemFree (FC_MEM_BLANKS, sizeof (FcBlanks));
free (b);
}
......@@ -65,6 +70,9 @@ FcBlanksAdd (FcBlanks *b, FcChar32 ucs4)
c = (FcChar32 *) malloc (sblank * sizeof (FcChar32));
if (!c)
return FcFalse;
if (b->sblank)
FcMemFree (FC_MEM_BLANKS, b->sblank * sizeof (FcChar32));
FcMemAlloc (FC_MEM_BLANKS, sblank * sizeof (FcChar32));
b->sblank = sblank;
b->blanks = c;
}
......
/*
* $XFree86: xc/lib/fontconfig/src/fccache.c,v 1.11 2002/08/19 19:32:05 keithp Exp $
* $XFree86: xc/lib/fontconfig/src/fccache.c,v 1.12 2002/08/22 07:36:44 keithp Exp $
*
* Copyright 2000 Keith Packard, member of The XFree86 Project, Inc.
*
......@@ -77,7 +77,7 @@ FcCacheReadString (FILE *f, FcChar8 *dest, int len)
}
if (i == size)
{
FcChar8 *new = malloc (size * 2);
FcChar8 *new = malloc (size * 2); /* freed in caller */
if (!new)
break;
memcpy (new, d, size);
......@@ -253,7 +253,7 @@ FcCacheFontSetAdd (FcFontSet *set,
len = (dir_len + 1 + strlen ((const char *) file) + 1);
if (len > sizeof (path_buf))
{
path = malloc (len);
path = malloc (len); /* freed down below */
if (!path)
return FcFalse;
}
......@@ -406,6 +406,7 @@ FcGlobalCacheDirGet (FcGlobalCache *cache,
d = malloc (sizeof (FcGlobalCacheDir) + len + 1);
if (!d)
return 0;
FcMemAlloc (FC_MEM_CACHE, sizeof (FcGlobalCacheDir) + len + 1);
d->next = *prev;
*prev = d;
d->info.hash = hash;
......@@ -451,6 +452,8 @@ FcGlobalCacheDirAdd (FcGlobalCache *cache,
strlen ((const char *) i.base) + 1);
if (!subdir)
return 0;
FcMemAlloc (FC_MEM_CACHE, sizeof (FcGlobalCacheSubdir) +
strlen ((const char *) i.base) + 1);
subdir->file = (FcChar8 *) (subdir + 1);
strcpy ((char *) subdir->file, (const char *) i.base);
subdir->next = parent->subdirs;
......@@ -469,13 +472,19 @@ FcGlobalCacheDirDestroy (FcGlobalCacheDir *d)
for (f = d->ents[h]; f; f = next)
{
next = f->next;
FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheFile) +
strlen ((char *) f->info.file) + 1 +
strlen ((char *) f->name) + 1);
free (f);
}
for (s = d->subdirs; s; s = nexts)
{
nexts = s->next;
FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheSubdir) +
strlen ((char *) s->file) + 1);
free (s);
}
FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheDir) + d->len + 1);
free (d);
}
......@@ -587,6 +596,7 @@ FcGlobalCacheFileAdd (FcGlobalCache *cache,
FcGlobalCacheDir *d = FcGlobalCacheDirGet (cache, i.dir,
i.dir_len, FcTrue);
FcGlobalCacheFile *f, **prev;
int size;
if (!d)
return 0;
......@@ -610,13 +620,18 @@ FcGlobalCacheFileAdd (FcGlobalCache *cache,
if (f->info.referenced)
cache->referenced--;
*prev = f->next;
FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCacheFile) +
strlen ((char *) f->info.file) + 1 +
strlen ((char *) f->name) + 1);
free (f);
}
f = malloc (sizeof (FcGlobalCacheFile) +
strlen ((char *) i.base) + 1 +
strlen ((char *) name) + 1);
size = (sizeof (FcGlobalCacheFile) +
strlen ((char *) i.base) + 1 +
strlen ((char *) name) + 1);
f = malloc (size);
if (!f)
return 0;
FcMemAlloc (FC_MEM_CACHE, size);
f->next = *prev;
*prev = f;
f->info.hash = i.base_hash;
......@@ -639,6 +654,7 @@ FcGlobalCacheCreate (void)
cache = malloc (sizeof (FcGlobalCache));
if (!cache)
return 0;
FcMemAlloc (FC_MEM_CACHE, sizeof (FcGlobalCache));
for (h = 0; h < FC_GLOBAL_CACHE_DIR_HASH_SIZE; h++)
cache->ents[h] = 0;
cache->entries = 0;
......@@ -662,6 +678,7 @@ FcGlobalCacheDestroy (FcGlobalCache *cache)
FcGlobalCacheDirDestroy (d);
}
}
FcMemFree (FC_MEM_CACHE, sizeof (FcGlobalCache));
free (cache);
}
......@@ -946,7 +963,7 @@ bail3:
bail2:
fclose (f);
bail1:
free (cache_file);
FcStrFree (cache_file);
bail0:
return ret;
}
......@@ -1036,7 +1053,7 @@ FcDirCacheWriteDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
if (!name)
goto bail3;
ret = FcCacheWriteString (f, name);
free (name);
FcStrFree (name);
if (!ret)
goto bail3;
if (PUTC ('\n', f) == EOF)
......@@ -1048,7 +1065,7 @@ FcDirCacheWriteDir (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
if (fclose (f) == EOF)
goto bail1;
free (cache_file);
FcStrFree (cache_file);
if (FcDebug () & FC_DBG_CACHE)
printf (" cache written\n");
......@@ -1060,7 +1077,7 @@ bail2:
fclose (f);
bail1:
unlink ((char *) cache_file);
free (cache_file);
FcStrFree (cache_file);
bail0:
return FcFalse;
}
/*
* $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.21 2002/08/22 07:36:44 keithp Exp $
* $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.22 2002/08/22 18:53:22 keithp Exp $
*
* Copyright 2000 Keith Packard, member of The XFree86 Project, Inc.
*
......@@ -429,6 +429,7 @@ FcConfigAddEdit (FcConfig *config,
subst = (FcSubst *) malloc (sizeof (FcSubst));
if (!subst)
return FcFalse;
FcMemAlloc (FC_MEM_SUBST, sizeof (FcSubst));
if (kind == FcMatchPattern)
prev = &config->substPattern;
else
......@@ -1274,10 +1275,11 @@ FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file)
strcat ((char *) path, "/");
strcat ((char *) path, (char *) file);
FcMemAlloc (FC_MEM_STRING, strlen ((char *) path) + 1);
if (access ((char *) path, R_OK) == 0)
return path;
free (path);
FcStrFree (path);
return 0;
}
......
/*
* $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.17 2002/07/13 05:43:25 keithp Exp $
* $XFree86: xc/lib/fontconfig/src/fccharset.c,v 1.18 2002/08/22 07:36:44 keithp Exp $
*
* Copyright 2001 Keith Packard, member of The XFree86 Project, Inc.
*
......@@ -142,7 +142,9 @@ FcCharSetPutLeaf (FcCharSet *fcs,
leaves = realloc (fcs->leaves, (fcs->num + 1) * sizeof (FcCharLeaf *));
if (!leaves)
return FcFalse;
FcMemAlloc (FC_MEM_CHARSET, sizeof (FcCharLeaf *));
if (fcs->num)
FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcCharLeaf *));
FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcCharLeaf *));
fcs->leaves = leaves;
if (!fcs->numbers)
numbers = malloc (sizeof (FcChar16));
......@@ -150,7 +152,9 @@ FcCharSetPutLeaf (FcCharSet *fcs,
numbers = realloc (fcs->numbers, (fcs->num + 1) * sizeof (FcChar16));
if (!numbers)
return FcFalse;
FcMemAlloc (FC_MEM_CHARSET, sizeof (FcChar16));
if (fcs->num)
FcMemFree (FC_MEM_CHARSET, fcs->num * sizeof (FcChar16));
FcMemAlloc (FC_MEM_CHARSET, (fcs->num + 1) * sizeof (FcChar16));
fcs->numbers = numbers;
memmove (fcs->leaves + pos + 1, fcs->leaves + pos,
......
......@@ -129,7 +129,7 @@ FcFileScan (FcFontSet *set,
if (unparse)
{
(void) FcGlobalCacheUpdate (cache, file, id, unparse);
free (unparse);
FcStrFree (unparse);
}
}
}
......@@ -181,6 +181,7 @@ FcDirScan (FcFontSet *set,
return FcTrue;
}
/* freed below */
file = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + FC_MAX_FILE_LEN + 1);
if (!file)
return FcFalse;
......
/*
* $XFree86: xc/lib/fontconfig/src/fcfreetype.c,v 1.9 2002/07/13 05:43:25 keithp Exp $
* $XFree86: xc/lib/fontconfig/src/fcfreetype.c,v 1.10 2002/08/22 07:36:44 keithp Exp $
*
* Copyright 2001 Keith Packard, member of The XFree86 Project, Inc.
*
......@@ -305,7 +305,7 @@ FcFreeTypeQuery (const FcChar8 *file,
continue;
/*
* Allocate plenty of space
* Allocate plenty of space. Freed below
*/
utf8 = malloc (len * FC_UTF8_MAX_LEN + 1);
if (!utf8)
......@@ -324,7 +324,7 @@ FcFreeTypeQuery (const FcChar8 *file,
break;
case FcNameEncodingLatin1:
/*
* Convert Latin1 to Utf8
* Convert Latin1 to Utf8. Freed below
*/
utf8 = malloc (src_len * 2 + 1);
if (!utf8)
......@@ -348,6 +348,7 @@ FcFreeTypeQuery (const FcChar8 *file,
if (!map)
continue;
/* freed below */
utf8 = malloc (src_len * 3 + 1);
if (!utf8)
continue;
......@@ -422,6 +423,7 @@ FcFreeTypeQuery (const FcChar8 *file,
end = (FcChar8 *) strrchr ((char *) start, '.');
if (!end)
end = start + strlen ((char *) start);
/* freed below */
family = malloc (end - start + 1);
strncpy ((char *) family, (char *) start, end - start);
family[end - start] = '\0';
......
/*
* $XFree86: xc/lib/fontconfig/src/fcinit.c,v 1.6 2002/05/23 23:00:46 keithp Exp $
* $XFree86: xc/lib/fontconfig/src/fcinit.c,v 1.7 2002/08/22 07:36:44 keithp Exp $
*
* Copyright 2001 Keith Packard, member of The XFree86 Project, Inc.
*
......@@ -154,23 +154,35 @@ static struct {
int free_count;
int free_mem;
} FcInUse[FC_MEM_NUM] = {
{ "charset", 0, 0 },
{ "charleaf", 0 ,0 },
{ "fontset", 0, 0 },
{ "fontptr", 0, 0 },
{ "objectset", 0, 0 },
{ "objectptr", 0, 0 },
{ "matrix", 0, 0 },
{ "pattern", 0, 0 },
{ "patelt", 0, 0 },
{ "vallist", 0, 0 },
{ "substate", 0, 0 },
{ "string", 0, 0 },
{ "listbuck", 0, 0 },
{ "strset", 0, 0 },
{ "strlist", 0, 0 },
{ "config", 0, 0 },
{ "langset", 0, 0 },
{ "charset" },
{ "charleaf" },
{ "fontset" },
{ "fontptr" },
{ "objectset" },
{ "objectptr" },
{ "matrix" },
{ "pattern" },
{ "patelt" },
{ "vallist" },
{ "substate" },
{ "string" },
{ "listbuck" },
{ "strset" },
{ "strlist" },
{ "config" },
{ "langset" },
{ "atomic" },
{ "blanks" },
{ "cache" },
{ "strbuf" },
{ "subst" },
{ "objecttype" },
{ "constant" },
{ "test" },
{ "expr" },
{ "vstack" },
{ "attr" },
{ "pstack" },
};
static int FcAllocCount, FcAllocMem;
......
......@@ -81,8 +81,20 @@ typedef struct _FcSymbolic {
#define FC_MEM_STRLIST 14
#define FC_MEM_CONFIG 15
#define FC_MEM_LANGSET 16
#define FC_MEM_NUM 17
#define FC_MEM_ATOMIC 17
#define FC_MEM_BLANKS 18
#define FC_MEM_CACHE 19
#define FC_MEM_STRBUF 20
#define FC_MEM_SUBST 21
#define FC_MEM_OBJECTTYPE 22
#define FC_MEM_CONSTANT 23
#define FC_MEM_TEST 24
#define FC_MEM_EXPR 25
#define FC_MEM_VSTACK 26
#define FC_MEM_ATTR 27
#define FC_MEM_PSTACK 28
#define FC_MEM_NUM 29
typedef enum _FcValueBinding {
FcValueBindingWeak, FcValueBindingStrong
......
/*
* $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.18 2002/08/19 19:32:05 keithp Exp $
* $XFree86: xc/lib/fontconfig/src/fcmatch.c,v 1.19 2002/08/22 07:36:44 keithp Exp $
*
* Copyright 2000 Keith Packard, member of The XFree86 Project, Inc.
*
......@@ -640,6 +640,7 @@ FcFontSetSort (FcConfig *config,
}
if (!nnodes)
goto bail0;
/* freed below */
nodes = malloc (nnodes * sizeof (FcSortNode) + nnodes * sizeof (FcSortNode *));
if (!nodes)
goto bail0;
......
/*
* $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.12 2002/08/19 19:32:05 keithp Exp $
* $XFree86: xc/lib/fontconfig/src/fcname.c,v 1.13 2002/08/22 07:36:45 keithp Exp $
*
* Copyright 2000 Keith Packard, member of The XFree86 Project, Inc.
*
......@@ -88,6 +88,7 @@ FcNameRegisterObjectTypes (const FcObjectType *types, int ntypes)
l = (FcObjectTypeList *) malloc (sizeof (FcObjectTypeList));
if (!l)
return FcFalse;
FcMemAlloc (FC_MEM_OBJECTTYPE, sizeof (FcObjectTypeList));
l->types = types;
l->ntypes = ntypes;
l->next = _FcObjectTypes;
......@@ -107,6 +108,7 @@ FcNameUnregisterObjectTypes (const FcObjectType *types, int ntypes)
if (l->types == types && l->ntypes == ntypes)
{
*prev = l->next;
FcMemFree (FC_MEM_OBJECTTYPE, sizeof (FcObjectTypeList));
free ((void *) l);
return FcTrue;
}
......@@ -181,6 +183,7 @@ FcNameRegisterConstants (const FcConstant *consts, int nconsts)
l = (FcConstantList *) malloc (sizeof (FcConstantList));
if (!l)
return FcFalse;
FcMemAlloc (FC_MEM_CONSTANT, sizeof (FcConstantList));
l->consts = consts;
l->nconsts = nconsts;
l->next = _FcConstants;
......@@ -200,6 +203,7 @@ FcNameUnregisterConstants (const FcConstant *consts, int nconsts)
if (l->consts == consts && l->nconsts == nconsts)
{
*prev = l->next;
FcMemFree (FC_MEM_CONSTANT, sizeof (FcConstantList));
free ((void *) l);
return FcTrue;
}
......@@ -347,6 +351,7 @@ FcNameParse (const FcChar8 *name)
const FcObjectType *t;
const FcConstant *c;
/* freed below */
save = malloc (strlen ((char *) name) + 1);
if (!save)
goto bail0;
......
/*
* $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.13 2002/08/11 18:10:42 keithp Exp $
* $XFree86: xc/lib/fontconfig/src/fcpat.c,v 1.15 2002/08/22 07:36:45 keithp Exp $
*
* Copyright 2000 Keith Packard, member of The XFree86 Project, Inc.
*
......@@ -482,6 +482,7 @@ FcPatternFreeze (FcPattern *p)
b = (FcPattern *) malloc (size);
if (!b)
return 0;
FcMemAlloc (FC_MEM_PATTERN, size);
b->num = p->num;
b->size = b->num;
b->ref = 1;
......
......@@ -341,6 +341,7 @@ FcStrBufDestroy (FcStrBuf *buf)
{
if (buf->allocated)
{
FcMemFree (FC_MEM_STRBUF, buf->size);
free (buf->buf);
FcStrBufInit (buf, 0, 0);
}
......@@ -354,6 +355,7 @@ FcStrBufDone (FcStrBuf *buf)
ret = malloc (buf->len + 1);
if (ret)
{
FcMemAlloc (FC_MEM_STRING, buf->len + 1);
memcpy (ret, buf->buf, buf->len);
ret[buf->len] = '\0';
}
......@@ -389,6 +391,9 @@ FcStrBufChar (FcStrBuf *buf, FcChar8 c)
buf->failed = FcTrue;
return FcFalse;
}
if (buf->size)
FcMemFree (FC_MEM_STRBUF, buf->size);
FcMemAlloc (FC_MEM_STRBUF, size);
buf->size = size;
buf->buf = new;
}
......
/*
* $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.20 2002/08/20 23:17:03 keithp Exp $
* $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.21 2002/08/22 18:53:22 keithp Exp $
*
* Copyright 2002 Keith Packard, member of The XFree86 Project, Inc.
*
......@@ -46,6 +46,7 @@ FcTestCreate (FcMatchKind kind,
if (test)
{
FcMemAlloc (FC_MEM_TEST, sizeof (FcTest));
test->next = 0;
test->kind = kind;
test->qual = qual;
......@@ -63,6 +64,7 @@ FcTestDestroy (FcTest *test)
FcTestDestroy (test->next);
FcExprDestroy (test->expr);
FcStrFree ((FcChar8 *) test->field);
FcMemFree (FC_MEM_TEST, sizeof (FcTest));
free (test);
}
......@@ -73,6 +75,7 @@ FcExprCreateInteger (int i)
if (e)
{
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpInteger;
e->u.ival = i;
}
......@@ -86,6 +89,7 @@ FcExprCreateDouble (double d)
if (e)
{
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpDouble;
e->u.dval = d;
}
......@@ -99,6 +103,7 @@ FcExprCreateString (const FcChar8 *s)
if (e)
{
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpString;
e->u.sval = FcStrCopy (s);
}
......@@ -112,6 +117,7 @@ FcExprCreateMatrix (const FcMatrix *m)
if (e)
{
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpMatrix;
e->u.mval = FcMatrixCopy (m);
}
......@@ -125,6 +131,7 @@ FcExprCreateBool (FcBool b)
if (e)
{
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpBool;
e->u.bval = b;
}
......@@ -138,6 +145,7 @@ FcExprCreateNil (void)
if (e)
{
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpNil;
}
return e;
......@@ -150,6 +158,7 @@ FcExprCreateField (const char *field)
if (e)
{
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpField;
e->u.field = (char *) FcStrCopy ((FcChar8 *) field);
}
......@@ -163,6 +172,7 @@ FcExprCreateConst (const FcChar8 *constant)
if (e)
{
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = FcOpConst;
e->u.constant = FcStrCopy (constant);
}
......@@ -176,6 +186,7 @@ FcExprCreateOp (FcExpr *left, FcOp op, FcExpr *right)
if (e)
{
FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr));
e->op = op;
e->u.tree.left = left;
e->u.tree.right = right;
......@@ -240,6 +251,7 @@ FcExprDestroy (FcExpr *e)
case FcOpInvalid:
break;
}
FcMemFree (FC_MEM_EXPR, sizeof (FcExpr));
free (e);
}
......@@ -491,6 +503,7 @@ FcVStackCreate (void)
new = malloc (sizeof (FcVStack));
if (!new)
return 0;
FcMemAlloc (FC_MEM_VSTACK, sizeof (FcVStack));
new->tag = FcVStackNone;
new->prev = 0;
return new;
......@@ -534,6 +547,7 @@ FcVStackDestroy (FcVStack *vstack)
FcEditDestroy (vstack->u.edit);
break;
}
FcMemFree (FC_MEM_VSTACK, sizeof (FcVStack));
free (vstack);
}
}
......@@ -704,6 +718,7 @@ FcConfigSaveAttr (const XML_Char **attr)
new = malloc ((i + 1) * sizeof (FcChar8 *) + slen);
if (!new)
return 0;
FcMemAlloc (FC_MEM_ATTR, 1); /* size is too expensive */
s = (FcChar8 *) (new + (i + 1));
for (i = 0; attr[i]; i++)
{
......@@ -722,6 +737,7 @@ FcPStackPush (FcConfigParse *parse, FcElement element, const XML_Char **attr)
if (!new)
return FcFalse;
FcMemAlloc (FC_MEM_PSTACK, sizeof (FcPStack));
new->prev = parse->pstack;
new->element = element;
if (attr)
......@@ -752,7 +768,11 @@ FcPStackPop (FcConfigParse *parse)
parse->pstack = old->prev;
FcStrBufDestroy (&old->str);
if (old->attr)
{
FcMemFree (FC_MEM_ATTR, 1); /* size is to expensive */
free (old->attr);
}
FcMemFree (FC_MEM_PSTACK, sizeof (FcPStack));
free (old);
return FcTrue;
}
......@@ -1317,7 +1337,7 @@ FcParseInclude (FcConfigParse *parse)
ignore_missing = FcTrue;
if (!FcConfigParseAndLoad (parse->config, s, !ignore_missing))
parse->error = FcTrue;
free (s);
FcStrFree (s);
}
typedef struct _FcOpMap {
......@@ -1580,7 +1600,7 @@ FcEndElement(void *userData, const XML_Char *name)
}
if (!FcConfigAddDir (parse->config, data))
FcConfigMessage (parse, FcSevereError, "out of memory");