Plug leaks

This commit is contained in:
Behdad Esfahbod 2011-05-11 14:19:18 -04:00
parent 7aa12ebdff
commit 6a7ac79e26
4 changed files with 20 additions and 1 deletions

View File

@ -120,6 +120,13 @@ struct hb_ot_map_t {
hb_ot_layout_position_lookup (font, buffer, lookup_maps[1][i].index, lookup_maps[1][i].mask);
}
inline void finish (void) {
feature_infos.finish ();
feature_maps.finish ();
lookup_maps[0].finish ();
lookup_maps[1].finish ();
}
private:
hb_mask_t global_mask;

View File

@ -51,6 +51,8 @@ struct hb_ot_shape_plan_t
{
hb_ot_map_t map;
hb_ot_complex_shaper_t shaper;
inline void finish (void) { map.finish (); }
};

View File

@ -381,6 +381,8 @@ hb_ot_shape (hb_font_t *font,
hb_ot_shape_plan_internal (&plan, font->face, &buffer->props, features, num_features);
hb_ot_shape_execute (&plan, font, buffer, features, num_features);
plan.finish ();
}

View File

@ -313,6 +313,14 @@ struct hb_prealloced_array_t {
{
return (const Type *) ::bsearch (key, array, len, sizeof (Type), (hb_compare_func_t) Type::cmp);
}
inline void finish (void)
{
if (array != static_array)
free (array);
array = NULL;
allocated = len = 0;
}
};
template <typename Type>
@ -394,7 +402,7 @@ struct hb_lockable_set_t
old.finish ();
l.lock ();
}
items.shrink (0);
items.finish ();
l.unlock ();
}