Fix a few memory tracking mistakes.
The built-in memory tracking code in fontconfig relies on a lot of manual function call tracking. A pain, but it helps debug leaks.
This commit is contained in:
parent
c6c9400d67
commit
13a14cbf56
|
@ -205,7 +205,7 @@ void
|
|||
FcAtomicDestroy (FcAtomic *atomic)
|
||||
{
|
||||
FcMemFree (FC_MEM_ATOMIC, sizeof (FcAtomic) +
|
||||
strlen ((char *) atomic->file) * 4 + 1 +
|
||||
strlen ((char *) atomic->file) * 4 + 4 +
|
||||
sizeof (NEW_NAME) + sizeof (LCK_NAME) +
|
||||
sizeof (TMP_NAME));
|
||||
|
||||
|
|
|
@ -1239,6 +1239,9 @@ FcCharSetFreezerDestroy (FcCharSetFreezer *freezer)
|
|||
for (ent = freezer->set_hash_table[i]; ent; ent = next)
|
||||
{
|
||||
next = ent->next;
|
||||
FcMemFree (FC_MEM_CHARSET, (sizeof (FcCharSetEnt) +
|
||||
ent->set.num * sizeof (FcCharLeaf *) +
|
||||
ent->set.num * sizeof (FcChar16)));
|
||||
free (ent);
|
||||
}
|
||||
}
|
||||
|
@ -1254,7 +1257,10 @@ FcCharSetFreezerDestroy (FcCharSetFreezer *freezer)
|
|||
}
|
||||
|
||||
for (i = 0; i < freezer->leaf_block_count; i++)
|
||||
{
|
||||
free (freezer->leaf_blocks[i]);
|
||||
FcMemFree (FC_MEM_CHARLEAF, FC_CHAR_LEAF_BLOCK * sizeof (FcCharLeafEnt));
|
||||
}
|
||||
|
||||
free (freezer->leaf_blocks);
|
||||
free (freezer);
|
||||
|
|
|
@ -141,6 +141,8 @@ FcFini (void)
|
|||
|
||||
FcPatternFini ();
|
||||
FcCacheFini ();
|
||||
if (FcDebug() & FC_DBG_MEMORY)
|
||||
FcMemReport ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1054,7 +1054,7 @@ FcStrStaticNameFini (void)
|
|||
next = b->next;
|
||||
name = (char *) (b + 1);
|
||||
size = sizeof (struct objectBucket) + strlen (name) + 1;
|
||||
FcMemFree (FC_MEM_STATICSTR, size);
|
||||
FcMemFree (FC_MEM_STATICSTR, size + sizeof (int));
|
||||
free (b);
|
||||
}
|
||||
FcObjectBuckets[i] = 0;
|
||||
|
|
|
@ -1025,11 +1025,14 @@ _FcStrSetAppend (FcStrSet *set, FcChar8 *s)
|
|||
if (!strs)
|
||||
return FcFalse;
|
||||
FcMemAlloc (FC_MEM_STRSET, (set->size + 2) * sizeof (FcChar8 *));
|
||||
set->size = set->size + 1;
|
||||
if (set->num)
|
||||
memcpy (strs, set->strs, set->num * sizeof (FcChar8 *));
|
||||
if (set->strs)
|
||||
{
|
||||
FcMemFree (FC_MEM_STRSET, (set->size + 1) * sizeof (FcChar8 *));
|
||||
free (set->strs);
|
||||
}
|
||||
set->size = set->size + 1;
|
||||
set->strs = strs;
|
||||
}
|
||||
set->strs[set->num++] = s;
|
||||
|
@ -1118,9 +1121,11 @@ FcStrSetDestroy (FcStrSet *set)
|
|||
|
||||
for (i = 0; i < set->num; i++)
|
||||
FcStrFree (set->strs[i]);
|
||||
FcMemFree (FC_MEM_STRSET, (set->size) * sizeof (FcChar8 *));
|
||||
if (set->strs)
|
||||
{
|
||||
FcMemFree (FC_MEM_STRSET, (set->size + 1) * sizeof (FcChar8 *));
|
||||
free (set->strs);
|
||||
}
|
||||
FcMemFree (FC_MEM_STRSET, sizeof (FcStrSet));
|
||||
free (set);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue