summaryrefslogtreecommitdiff
path: root/boilerplate/cairo-boilerplate.c
diff options
context:
space:
mode:
authorBryce Harrington <bryce@osg.samsung.com>2018-05-07 17:11:24 -0700
committerAdrian Johnson <ajohnson@redneon.com>2021-07-23 18:33:19 +0930
commitc91ae5c5a06d1b0f558f9a83637ba5df99cd2af5 (patch)
tree7bc7151f3229a93be78e4680e0759f635468466b /boilerplate/cairo-boilerplate.c
parentae04679a08f39597907c28c317062b1f22ecf8f8 (diff)
downloadcairo-c91ae5c5a06d1b0f558f9a83637ba5df99cd2af5.tar.gz
boilerplate: Use _cairo_malloc instead of malloc
This changes most instances of malloc() calls to use Cairo's safer _cairo_malloc(). The malloc() call in the implementation of boilerplate's xmalloc() is not changed since it already includes a size=0 check. Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'boilerplate/cairo-boilerplate.c')
-rw-r--r--boilerplate/cairo-boilerplate.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 024870a83..c5d3ad236 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -26,6 +26,7 @@
#include "cairo-boilerplate-private.h"
#include "cairo-boilerplate-scaled-font.h"
+#include "cairo-malloc-private.h"
#include <pixman.h>
@@ -177,7 +178,7 @@ _cairo_boilerplate_image_create_similar (cairo_surface_t *other,
}
stride = cairo_format_stride_for_width(format, width);
- ptr = malloc (stride* height);
+ ptr = _cairo_malloc (stride * height);
surface = cairo_image_surface_create_for_data (ptr, format,
width, height, stride);
@@ -226,7 +227,7 @@ _cairo_boilerplate_image16_create_similar (cairo_surface_t *other,
}
stride = cairo_format_stride_for_width(format, width);
- ptr = malloc (stride* height);
+ ptr = _cairo_malloc (stride * height);
surface = cairo_image_surface_create_for_data (ptr, format,
width, height, stride);
@@ -239,7 +240,7 @@ static char *
_cairo_boilerplate_image_describe (void *closure)
{
char *s;
-
+
xasprintf (&s, "pixman %s", pixman_version_string ());
return s;