atsui: Add missing check of return-value of malloc.

This addresses the original problem noted in mozilla's bug #336129:

	Missing out-of-memory check at gfx/cairo/cairo/src/cairo-atsui-font.c:185
	https://bugzilla.mozilla.org/show_bug.cgi?id=336129

This also adds a comment pointing out another malloc that is not
checked, (but does not fix it).
This commit is contained in:
Carl Worth 2006-05-02 11:36:41 -07:00
parent 41e288a880
commit e59f35291f

View file

@ -211,6 +211,8 @@ _cairo_atsui_font_create_scaled (cairo_font_face_t *font_face,
cairo_status_t status;
font = malloc(sizeof(cairo_atsui_font_t));
if (font == NULL)
return CAIRO_STATUS_NO_MEMORY;
_cairo_scaled_font_init(&font->base, font_face, font_matrix, ctm, options,
&cairo_atsui_scaled_font_backend);
@ -640,7 +642,11 @@ _cairo_atsui_font_old_show_glyphs (void *abstract_font,
CGRect stack_rects[10];
CGRect *rects;
int i;
/* XXX: Return-value of malloc needs to be checked for
* NULL. Can someone fix this who is more familiar with
* the cleanup needed in this function?
*/
if (num_boxes > 10)
rects = malloc (sizeof (CGRect) * num_boxes);
else