diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-10-03 23:25:10 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-10-04 00:42:30 +0100 |
commit | 66664596559c55913fb0b9c8784fe8ab862c217b (patch) | |
tree | 60e9e0232fbb0dec33e27c929498dd181fda693f /src/cairo-ft-font.c | |
parent | e49bcde27f88e21d5b8037a0089a226096f6514b (diff) |
[malloc] Take advantage of calloc() argument checking.
calloc() will check its arguments for integer overflows so it is safer
not to pre-multiply them.
Diffstat (limited to 'src/cairo-ft-font.c')
-rw-r--r-- | src/cairo-ft-font.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 3262163fb..38a4a8dc5 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -840,7 +840,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap, width_rgba = width; stride = bitmap->pitch; stride_rgba = (width_rgba * 4 + 3) & ~3; - data_rgba = calloc (1, stride_rgba * height); + data_rgba = calloc (stride_rgba, height); if (data_rgba == NULL) { if (own_buffer) free (bitmap->buffer); @@ -1041,7 +1041,7 @@ _render_glyph_outline (FT_Face face, bitmap.pitch = stride; bitmap.width = width * hmul; bitmap.rows = height * vmul; - bitmap.buffer = calloc (1, stride * bitmap.rows); + bitmap.buffer = calloc (stride, bitmap.rows); if (bitmap.buffer == NULL) { _cairo_error (CAIRO_STATUS_NO_MEMORY); |