mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-01 17:17:59 +02:00
[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:
parent
c394b72ee9
commit
6227d80844
1 changed files with 7 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue