mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-06-08 09:18:19 +02:00
[cairo-scaled-font-subsets] Destroy the parent and subfont on error.
If we fail to create the sub font destroy the local reference to the parent font and if we fail to insert the sub font into the hash table, destroy the newly create sub font.
This commit is contained in:
parent
fcd1076bcf
commit
b63b32958e
1 changed files with 12 additions and 4 deletions
|
|
@ -553,13 +553,17 @@ _cairo_scaled_font_subsets_map_glyph (cairo_scaled_font_subsets_t *subsets,
|
|||
max_glyphs,
|
||||
subset_glyph->is_scaled,
|
||||
subset_glyph->is_composite);
|
||||
if (sub_font == NULL)
|
||||
if (sub_font == NULL) {
|
||||
cairo_scaled_font_destroy (unscaled_font);
|
||||
return CAIRO_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
status = _cairo_hash_table_insert (subsets->unscaled_sub_fonts,
|
||||
&sub_font->base);
|
||||
if (status)
|
||||
if (status) {
|
||||
_cairo_sub_font_destroy (sub_font);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* No path available. Add to scaled subset. */
|
||||
|
|
@ -581,13 +585,17 @@ _cairo_scaled_font_subsets_map_glyph (cairo_scaled_font_subsets_t *subsets,
|
|||
max_glyphs,
|
||||
subset_glyph->is_scaled,
|
||||
subset_glyph->is_composite);
|
||||
if (sub_font == NULL)
|
||||
if (sub_font == NULL) {
|
||||
cairo_scaled_font_destroy (scaled_font);
|
||||
return CAIRO_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
status = _cairo_hash_table_insert (subsets->scaled_sub_fonts,
|
||||
&sub_font->base);
|
||||
if (status)
|
||||
if (status) {
|
||||
_cairo_sub_font_destroy (sub_font);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue