diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-10-04 00:38:12 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-10-04 00:42:30 +0100 |
commit | 8ad56b308ae8bbecfe9873c21551a6d4b2302420 (patch) | |
tree | a9c8791e8c30f70fc24a1b1ade069e54c23d98be /src/cairo-scaled-font-subsets.c | |
parent | 66664596559c55913fb0b9c8784fe8ab862c217b (diff) |
[malloc/error] Add call to _cairo_error() after a failed malloc.
Blitz all allocations to ensure that they raise a
_cairo_error(CAIRO_STATUS_NO_MEMORY) on failure.
Diffstat (limited to 'src/cairo-scaled-font-subsets.c')
-rw-r--r-- | src/cairo-scaled-font-subsets.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c index ea2e63ae..a5d9c49e 100644 --- a/src/cairo-scaled-font-subsets.c +++ b/src/cairo-scaled-font-subsets.c @@ -124,8 +124,10 @@ _cairo_sub_font_glyph_create (unsigned long scaled_font_glyph_index, cairo_sub_font_glyph_t *sub_font_glyph; sub_font_glyph = malloc (sizeof (cairo_sub_font_glyph_t)); - if (sub_font_glyph == NULL) + if (sub_font_glyph == NULL) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); return NULL; + } _cairo_sub_font_glyph_init_key (sub_font_glyph, scaled_font_glyph_index); sub_font_glyph->subset_id = subset_id; @@ -214,8 +216,10 @@ _cairo_sub_font_create (cairo_scaled_font_subsets_t *parent, cairo_sub_font_t *sub_font; sub_font = malloc (sizeof (cairo_sub_font_t)); - if (sub_font == NULL) + if (sub_font == NULL) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); return NULL; + } sub_font->is_scaled = is_scaled; sub_font->is_composite = is_composite; @@ -410,9 +414,11 @@ _cairo_scaled_font_subsets_create_internal (cairo_subsets_type_t type) { cairo_scaled_font_subsets_t *subsets; - subsets = malloc (sizeof (cairo_scaled_font_subsets_t)); - if (subsets == NULL) + subsets = malloc (sizeof (cairo_scaled_font_subsets_t)); + if (subsets == NULL) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); return NULL; + } subsets->type = type; subsets->max_glyphs_per_unscaled_subset_used = 0; @@ -623,8 +629,10 @@ _cairo_scaled_font_subsets_foreach_internal (cairo_scaled_font_subsets_t return CAIRO_STATUS_SUCCESS; collection.glyphs = _cairo_malloc_ab (collection.glyphs_size, sizeof(unsigned long)); - if (collection.glyphs == NULL) + if (collection.glyphs == NULL) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); return CAIRO_STATUS_NO_MEMORY; + } collection.font_subset_callback = font_subset_callback; collection.font_subset_callback_closure = closure; |