[cairo-scaled-font-subsets] And free the allocated memory on failure.

Why, oh why, did I only spot this when reading cairo-commit?
This commit is contained in:
Chris Wilson 2008-06-29 14:32:17 +01:00
parent c394b72ee9
commit 6227d80844

View file

@ -810,8 +810,14 @@ _cairo_scaled_font_subsets_foreach_internal (cairo_scaled_font_subsets_t
collection.glyphs = _cairo_malloc_ab (collection.glyphs_size, sizeof(unsigned long));
collection.utf8 = _cairo_malloc_ab (collection.glyphs_size, sizeof(char *));
if (collection.glyphs == NULL || collection.utf8 == NULL)
if (collection.glyphs == NULL || collection.utf8 == NULL) {
if (collection.glyphs != NULL)
free (collection.glyphs);
if (collection.utf8 != NULL)
free (collection.utf8);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
collection.font_subset_callback = font_subset_callback;
collection.font_subset_callback_closure = closure;