6
diff --git a/pango/pangoft2-render.c b/pango/pangoft2-render.c
7
index bd3b7d4..42923f4 100644
8
--- a/pango/pangoft2-render.c
9
+++ b/pango/pangoft2-render.c
10
@@ -121,9 +121,14 @@ pango_ft2_font_render_box_glyph (int width,
12
box->bitmap.width = width;
13
box->bitmap.rows = height;
14
- box->bitmap.pitch = height;
15
+ box->bitmap.pitch = width;
17
- box->bitmap.buffer = g_malloc0 (box->bitmap.rows * box->bitmap.pitch);
18
+ box->bitmap.buffer = g_malloc0_n (box->bitmap.rows, box->bitmap.pitch);
20
+ if (G_UNLIKELY (!box->bitmap.buffer)) {
21
+ g_slice_free (PangoFT2RenderedGlyph, box);
26
for (j = 0; j < line_width; j++)
27
@@ -226,6 +231,11 @@ pango_ft2_font_render_glyph (PangoFont *font,
28
rendered->bitmap_left = face->glyph->bitmap_left;
29
rendered->bitmap_top = face->glyph->bitmap_top;
31
+ if (G_UNLIKELY (!rendered->bitmap.buffer)) {
32
+ g_slice_free (PangoFT2RenderedGlyph, rendered);
39
@@ -276,6 +286,8 @@ pango_ft2_renderer_draw_glyph (PangoRenderer *renderer,
40
if (rendered_glyph == NULL)
42
rendered_glyph = pango_ft2_font_render_glyph (font, glyph);
43
+ if (rendered_glyph == NULL)
45
add_glyph_to_cache = TRUE;