Use _cairo_malloc instead of malloc

_cairo_malloc(0) always returns NULL, but has not been used
consistently.  This patch replaces many calls to malloc() with
_cairo_malloc().

Fixes:  fdo# 101547
CVE: CVE-2017-9814 Heap buffer overflow at cairo-truetype-subset.c:1299
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
Adrian Johnson 2017-07-08 09:28:03 +09:30 committed by Bryce Harrington
parent 7554822dd0
commit 1998239387
102 changed files with 300 additions and 274 deletions

View file

@ -0,0 +1,26 @@
From ceb9783179c1002acb61bfb2d5a1801f450c2b37 Mon Sep 17 00:00:00 2001
From: Bryce Harrington <bryce@osg.samsung.com>
Date: Wed, 20 Sep 2017 16:05:54 -0700
Subject: [PATCH cairo] polygon-intersection: Check for invalid right edge
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
---
src/cairo-polygon-intersect.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/cairo-polygon-intersect.c b/src/cairo-polygon-intersect.c
index 9c1777f..6fab924 100644
--- a/src/cairo-polygon-intersect.c
+++ b/src/cairo-polygon-intersect.c
@@ -1166,6 +1166,8 @@ active_edges (cairo_bo_edge_t *left,
} while (1);
right = left->next;
+ if (! right)
+ return;
do {
if unlikely ((right->deferred.other))
edges_end (right, top, polygon);
--
2.7.4

View file

@ -118,7 +118,7 @@ attach_proxy (cairo_surface_t *source,
{
struct proxy *proxy;
proxy = malloc (sizeof (*proxy));
proxy = _cairo_malloc (sizeof (*proxy));
if (unlikely (proxy == NULL))
return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY);
@ -830,7 +830,7 @@ _cairo_analysis_surface_create (cairo_surface_t *target)
if (unlikely (status))
return _cairo_surface_create_in_error (status);
surface = malloc (sizeof (cairo_analysis_surface_t));
surface = _cairo_malloc (sizeof (cairo_analysis_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -1020,7 +1020,7 @@ _cairo_null_surface_create (cairo_content_t content)
{
cairo_surface_t *surface;
surface = malloc (sizeof (cairo_surface_t));
surface = _cairo_malloc (sizeof (cairo_surface_t));
if (unlikely (surface == NULL)) {
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
}

View file

@ -125,7 +125,7 @@ _cairo_base64_stream_create (cairo_output_stream_t *output)
if (output->status)
return _cairo_output_stream_create_in_error (output->status);
stream = malloc (sizeof (cairo_base64_stream_t));
stream = _cairo_malloc (sizeof (cairo_base64_stream_t));
if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;

View file

@ -114,7 +114,7 @@ _cairo_base85_stream_create (cairo_output_stream_t *output)
if (output->status)
return _cairo_output_stream_create_in_error (output->status);
stream = malloc (sizeof (cairo_base85_stream_t));
stream = _cairo_malloc (sizeof (cairo_base85_stream_t));
if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;

View file

@ -547,7 +547,7 @@ cff_index_append_copy (cairo_array_t *index,
element.length = length;
element.is_copy = TRUE;
element.data = malloc (element.length);
element.data = _cairo_malloc (element.length);
if (unlikely (element.data == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -610,12 +610,12 @@ cff_dict_create_operator (int operator,
{
cff_dict_operator_t *op;
op = malloc (sizeof (cff_dict_operator_t));
op = _cairo_malloc (sizeof (cff_dict_operator_t));
if (unlikely (op == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_dict_init_key (op, operator);
op->operand = malloc (size);
op->operand = _cairo_malloc (size);
if (unlikely (op->operand == NULL)) {
free (op);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -716,7 +716,7 @@ cff_dict_set_operands (cairo_hash_table_t *dict,
op = _cairo_hash_table_lookup (dict, &key.base);
if (op != NULL) {
free (op->operand);
op->operand = malloc (size);
op->operand = _cairo_malloc (size);
if (unlikely (op->operand == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -870,7 +870,7 @@ cairo_cff_font_read_name (cairo_cff_font_t *font)
len -= 7;
}
}
font->ps_name = malloc (len + 1);
font->ps_name = _cairo_malloc (len + 1);
if (unlikely (font->ps_name == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1858,7 +1858,7 @@ cairo_cff_font_create_cid_fontdict (cairo_cff_font_t *font)
cairo_status_t status;
font->num_fontdicts = 1;
font->fd_dict = malloc (sizeof (cairo_hash_table_t *));
font->fd_dict = _cairo_malloc (sizeof (cairo_hash_table_t *));
if (unlikely (font->fd_dict == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1869,11 +1869,11 @@ cairo_cff_font_create_cid_fontdict (cairo_cff_font_t *font)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
font->fd_subset_map = malloc (sizeof (int));
font->fd_subset_map = _cairo_malloc (sizeof (int));
if (unlikely (font->fd_subset_map == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
font->private_dict_offset = malloc (sizeof (int));
font->private_dict_offset = _cairo_malloc (sizeof (int));
if (unlikely (font->private_dict_offset == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1968,7 +1968,7 @@ cairo_cff_font_subset_font (cairo_cff_font_t *font)
if (unlikely (status))
return status;
} else {
font->private_dict_offset = malloc (sizeof (int));
font->private_dict_offset = _cairo_malloc (sizeof (int));
if (unlikely (font->private_dict_offset == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
@ -2560,7 +2560,7 @@ cairo_cff_font_generate (cairo_cff_font_t *font,
/* If the PS name is not found, create a CairoFont-x-y name. */
if (font->ps_name == NULL) {
font->ps_name = malloc (30);
font->ps_name = _cairo_malloc (30);
if (unlikely (font->ps_name == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -2710,7 +2710,7 @@ _cairo_cff_font_load_opentype_cff (cairo_cff_font_t *font)
font->is_opentype = TRUE;
font->data_length = data_length;
font->data = malloc (data_length);
font->data = _cairo_malloc (data_length);
if (unlikely (font->data == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -2745,7 +2745,7 @@ _cairo_cff_font_load_cff (cairo_cff_font_t *font)
font->font_name = NULL;
font->is_opentype = FALSE;
font->data_length = data_length;
font->data = malloc (data_length);
font->data = _cairo_malloc (data_length);
if (unlikely (font->data == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -2981,7 +2981,7 @@ _cairo_cff_subset_init (cairo_cff_subset_t *cff_subset,
cff_subset->ascent = (double)font->ascent/font->units_per_em;
cff_subset->descent = (double)font->descent/font->units_per_em;
cff_subset->data = malloc (length);
cff_subset->data = _cairo_malloc (length);
if (unlikely (cff_subset->data == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail4;
@ -3040,7 +3040,7 @@ _cairo_cff_scaled_font_is_cid_cff (cairo_scaled_font_t *scaled_font)
(status = backend->load_truetype_table (scaled_font, TT_TAG_CFF,
0, NULL, &data_length)) == CAIRO_INT_STATUS_SUCCESS)
{
data = malloc (data_length);
data = _cairo_malloc (data_length);
if (unlikely (data == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
return FALSE;
@ -3057,7 +3057,7 @@ _cairo_cff_scaled_font_is_cid_cff (cairo_scaled_font_t *scaled_font)
(status = backend->load_type1_data (scaled_font,
0, NULL, &data_length)) == CAIRO_INT_STATUS_SUCCESS)
{
data = malloc (data_length);
data = _cairo_malloc (data_length);
if (unlikely (data == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
return FALSE;
@ -3130,7 +3130,7 @@ _cairo_cff_font_fallback_create (cairo_scaled_font_subset_t *scaled_font_subset
cairo_status_t status;
cairo_cff_font_t *font;
font = malloc (sizeof (cairo_cff_font_t));
font = _cairo_malloc (sizeof (cairo_cff_font_t));
if (unlikely (font == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -3316,7 +3316,7 @@ cairo_cff_font_fallback_generate (cairo_cff_font_t *font,
if (unlikely (status))
return status;
} else {
font->private_dict_offset = malloc (sizeof (int));
font->private_dict_offset = _cairo_malloc (sizeof (int));
if (unlikely (font->private_dict_offset == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
@ -3393,7 +3393,7 @@ _cairo_cff_fallback_init (cairo_cff_subset_t *cff_subset,
cff_subset->ascent = (double)type2_subset.y_max/1000;
cff_subset->descent = (double)type2_subset.y_min/1000;
cff_subset->data = malloc (length);
cff_subset->data = _cairo_malloc (length);
if (unlikely (cff_subset->data == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail4;

View file

@ -465,7 +465,7 @@ _pool_chunk_create(struct pool *pool, size_t size)
{
struct _pool_chunk *p;
p = malloc(size + sizeof(struct _pool_chunk));
p = _cairo_malloc (size + sizeof(struct _pool_chunk));
if (unlikely (NULL == p))
longjmp (*pool->jmp, _cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -62,7 +62,7 @@ _cairo_clip_path_create (cairo_clip_t *clip)
clip_path = _freed_pool_get (&clip_path_pool);
if (unlikely (clip_path == NULL)) {
clip_path = malloc (sizeof (cairo_clip_path_t));
clip_path = _cairo_malloc (sizeof (cairo_clip_path_t));
if (unlikely (clip_path == NULL))
return NULL;
}
@ -108,7 +108,7 @@ _cairo_clip_create (void)
clip = _freed_pool_get (&clip_pool);
if (unlikely (clip == NULL)) {
clip = malloc (sizeof (cairo_clip_t));
clip = _cairo_malloc (sizeof (cairo_clip_t));
if (unlikely (clip == NULL))
return NULL;
}
@ -735,7 +735,7 @@ _cairo_rectangle_list_create_in_error (cairo_status_t status)
if (status == CAIRO_STATUS_CLIP_NOT_REPRESENTABLE)
return (cairo_rectangle_list_t*) &_cairo_rectangles_not_representable;
list = malloc (sizeof (*list));
list = _cairo_malloc (sizeof (*list));
if (unlikely (list == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
return (cairo_rectangle_list_t*) &_cairo_rectangles_nil;
@ -795,7 +795,7 @@ _cairo_clip_copy_rectangle_list (cairo_clip_t *clip, cairo_gstate_t *gstate)
}
DONE:
list = malloc (sizeof (cairo_rectangle_list_t));
list = _cairo_malloc (sizeof (cairo_rectangle_list_t));
if (unlikely (list == NULL)) {
free (rectangles);
return ERROR_LIST (CAIRO_STATUS_NO_MEMORY);

View file

@ -755,7 +755,7 @@ _cairo_cogl_context_create (void *target)
cr = _freed_pool_get (&context_pool);
if (unlikely (cr == NULL)) {
cr = malloc (sizeof (cairo_cogl_context_t));
cr = _cairo_malloc (sizeof (cairo_cogl_context_t));
if (unlikely (cr == NULL))
return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
}

View file

@ -397,7 +397,7 @@ _cairo_cogl_get_linear_gradient (cairo_cogl_device_t *device,
}
if (!gradient) {
gradient = malloc (sizeof (cairo_cogl_linear_gradient_t) +
gradient = _cairo_malloc (sizeof (cairo_cogl_linear_gradient_t) +
sizeof (cairo_gradient_stop_t) * (n_stops - 1));
if (!gradient)
return CAIRO_INT_STATUS_NO_MEMORY;
@ -413,7 +413,7 @@ _cairo_cogl_get_linear_gradient (cairo_cogl_device_t *device,
} else
_cairo_cogl_linear_gradient_reference (gradient);
entry = malloc (sizeof (cairo_cogl_linear_texture_entry_t));
entry = _cairo_malloc (sizeof (cairo_cogl_linear_texture_entry_t));
if (!entry) {
status = CAIRO_INT_STATUS_NO_MEMORY;
goto BAIL;

View file

@ -1994,7 +1994,7 @@ _cairo_cogl_get_path_stroke_meta (cairo_cogl_surface_t *surface,
CAIRO_REFERENCE_COUNT_INIT (&meta->ref_count, 1);
meta->cache_entry.hash = hash;
meta->counter = 0;
meta_path = malloc (sizeof (cairo_path_fixed_t));
meta_path = _cairo_malloc (sizeof (cairo_path_fixed_t));
if (!meta_path)
goto BAIL;
/* FIXME: we should add a ref-counted wrapper for our user_paths
@ -2248,7 +2248,7 @@ _cairo_cogl_get_path_fill_meta (cairo_cogl_surface_t *surface)
meta->cache_entry.hash = hash;
meta->counter = 0;
CAIRO_REFERENCE_COUNT_INIT (&meta->ref_count, 1);
meta_path = malloc (sizeof (cairo_path_fixed_t));
meta_path = _cairo_malloc (sizeof (cairo_path_fixed_t));
if (!meta_path)
goto BAIL;
/* FIXME: we should add a ref-counted wrapper for our user_paths
@ -2504,7 +2504,7 @@ _cairo_cogl_surface_create_full (cairo_cogl_device_t *dev,
if (unlikely (status))
return _cairo_surface_create_in_error (status);
surface = malloc (sizeof (cairo_cogl_surface_t));
surface = _cairo_malloc (sizeof (cairo_cogl_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -51,7 +51,7 @@ _cairo_damage_create (void)
{
cairo_damage_t *damage;
damage = malloc (sizeof (*damage));
damage = _cairo_malloc (sizeof (*damage));
if (unlikely (damage == NULL)) {
_cairo_error_throw(CAIRO_STATUS_NO_MEMORY);
return (cairo_damage_t *) &__cairo_damage__nil;
@ -122,7 +122,7 @@ _cairo_damage_add_boxes(cairo_damage_t *damage,
if (size < count)
size = (count + 64) & ~63;
chunk = malloc (sizeof (*chunk) + sizeof (cairo_box_t) * size);
chunk = _cairo_malloc (sizeof (*chunk) + sizeof (cairo_box_t) * size);
if (unlikely (chunk == NULL)) {
_cairo_damage_destroy (damage);
return (cairo_damage_t *) &__cairo_damage__nil;
@ -210,7 +210,7 @@ _cairo_damage_reduce (cairo_damage_t *damage)
boxes = damage->tail->base;
if (damage->dirty > damage->tail->size) {
boxes = free_boxes = malloc (damage->dirty * sizeof (cairo_box_t));
boxes = free_boxes = _cairo_malloc (damage->dirty * sizeof (cairo_box_t));
if (unlikely (boxes == NULL)) {
_cairo_damage_destroy (damage);
return (cairo_damage_t *) &__cairo_damage__nil;

View file

@ -1481,7 +1481,7 @@ _cairo_default_context_create (void *target)
cr = _freed_pool_get (&context_pool);
if (unlikely (cr == NULL)) {
cr = malloc (sizeof (cairo_default_context_t));
cr = _cairo_malloc (sizeof (cairo_default_context_t));
if (unlikely (cr == NULL))
return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
}

View file

@ -124,7 +124,7 @@ _cairo_deflate_stream_create (cairo_output_stream_t *output)
if (output->status)
return _cairo_output_stream_create_in_error (output->status);
stream = malloc (sizeof (cairo_deflate_stream_t));
stream = _cairo_malloc (sizeof (cairo_deflate_stream_t));
if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;

View file

@ -288,7 +288,7 @@ twin_font_face_create_properties (cairo_font_face_t *twin_face)
{
twin_face_properties_t *props;
props = malloc (sizeof (twin_face_properties_t));
props = _cairo_malloc (sizeof (twin_face_properties_t));
if (unlikely (props == NULL))
return NULL;
@ -412,7 +412,7 @@ twin_scaled_font_compute_properties (cairo_scaled_font_t *scaled_font,
cairo_status_t status;
twin_scaled_properties_t *props;
props = malloc (sizeof (twin_scaled_properties_t));
props = _cairo_malloc (sizeof (twin_scaled_properties_t));
if (unlikely (props == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -109,7 +109,7 @@ cairo_font_options_create (void)
{
cairo_font_options_t *options;
options = malloc (sizeof (cairo_font_options_t));
options = _cairo_malloc (sizeof (cairo_font_options_t));
if (!options) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_font_options_t *) &_cairo_font_options_nil;
@ -143,7 +143,7 @@ cairo_font_options_copy (const cairo_font_options_t *original)
if (cairo_font_options_status ((cairo_font_options_t *) original))
return (cairo_font_options_t *) &_cairo_font_options_nil;
options = malloc (sizeof (cairo_font_options_t));
options = _cairo_malloc (sizeof (cairo_font_options_t));
if (!options) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_font_options_t *) &_cairo_font_options_nil;

View file

@ -61,7 +61,7 @@ _cairo_freelist_alloc (cairo_freelist_t *freelist)
return node;
}
return malloc (freelist->nodesize);
return _cairo_malloc (freelist->nodesize);
}
void *
@ -139,7 +139,7 @@ _cairo_freepool_alloc_from_new_pool (cairo_freepool_t *freepool)
else
poolsize = (128 * freepool->nodesize + 8191) & -8192;
pool = malloc (sizeof (cairo_freelist_pool_t) + poolsize);
pool = _cairo_malloc (sizeof (cairo_freelist_pool_t) + poolsize);
if (unlikely (pool == NULL))
return pool;

View file

@ -300,7 +300,7 @@ _cairo_ft_unscaled_font_map_create (void)
* detect some other call path. */
assert (cairo_ft_unscaled_font_map == NULL);
font_map = malloc (sizeof (cairo_ft_unscaled_font_map_t));
font_map = _cairo_malloc (sizeof (cairo_ft_unscaled_font_map_t));
if (unlikely (font_map == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -563,7 +563,7 @@ _cairo_ft_unscaled_font_create_internal (cairo_bool_t from_face,
}
/* Otherwise create it and insert into hash table. */
unscaled = malloc (sizeof (cairo_ft_unscaled_font_t));
unscaled = _cairo_malloc (sizeof (cairo_ft_unscaled_font_t));
if (unlikely (unscaled == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto UNWIND_FONT_MAP_LOCK;
@ -2015,7 +2015,7 @@ _cairo_ft_font_face_scaled_font_create (void *abstract_font_face,
if (unlikely (face == NULL)) /* backend error */
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
scaled_font = malloc (sizeof (cairo_ft_scaled_font_t));
scaled_font = _cairo_malloc (sizeof (cairo_ft_scaled_font_t));
if (unlikely (scaled_font == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto FAIL;
@ -3247,7 +3247,7 @@ _cairo_ft_font_face_create_for_pattern (FcPattern *pattern)
{
cairo_ft_font_face_t *font_face;
font_face = malloc (sizeof (cairo_ft_font_face_t));
font_face = _cairo_malloc (sizeof (cairo_ft_font_face_t));
if (unlikely (font_face == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_font_face_t *) &_cairo_font_face_nil;
@ -3309,7 +3309,7 @@ _cairo_ft_font_face_create (cairo_ft_unscaled_font_t *unscaled,
}
/* No match found, create a new one */
font_face = malloc (sizeof (cairo_ft_font_face_t));
font_face = _cairo_malloc (sizeof (cairo_ft_font_face_t));
if (unlikely (!font_face)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_font_face_t *)&_cairo_font_face_nil;

View file

@ -307,7 +307,7 @@ _cairo_gl_context_init (cairo_gl_context_t *ctx)
ctx->vbo_size = _cairo_gl_get_vbo_size();
ctx->vb = malloc (ctx->vbo_size);
ctx->vb = _cairo_malloc (ctx->vbo_size);
if (unlikely (ctx->vb == NULL)) {
_cairo_cache_fini (&ctx->gradients);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -248,7 +248,7 @@ _cairo_gl_gradient_create (cairo_gl_context_t *ctx,
return CAIRO_STATUS_SUCCESS;
}
gradient = malloc (sizeof (cairo_gl_gradient_t) + sizeof (cairo_gradient_stop_t) * (n_stops - 1));
gradient = _cairo_malloc (sizeof (cairo_gl_gradient_t) + sizeof (cairo_gradient_stop_t) * (n_stops - 1));
if (gradient == NULL)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -1060,7 +1060,7 @@ _cairo_gl_get_shader_by_type (cairo_gl_context_t *ctx,
if (unlikely (status))
return status;
entry = malloc (sizeof (cairo_shader_cache_entry_t));
entry = _cairo_malloc (sizeof (cairo_shader_cache_entry_t));
if (unlikely (entry == NULL)) {
free (fs_source);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -69,7 +69,7 @@ _cairo_gl_pattern_to_source (cairo_surface_t *dst,
if (pattern == NULL)
return _cairo_gl_white_source ();
source = malloc (sizeof (*source));
source = _cairo_malloc (sizeof (*source));
if (unlikely (source == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -97,7 +97,7 @@ _cairo_gl_white_source (void)
{
cairo_gl_source_t *source;
source = malloc (sizeof (*source));
source = _cairo_malloc (sizeof (*source));
if (unlikely (source == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -1259,7 +1259,7 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
uint8_t *bot = image->data + (image->height-1)*image->stride;
if (image->stride > (int)sizeof(stack)) {
row = malloc (image->stride);
row = _cairo_malloc (image->stride);
if (unlikely (row == NULL)) {
cairo_surface_destroy (&image->base);
return _cairo_image_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -241,7 +241,7 @@ _cairo_gstate_save (cairo_gstate_t **gstate, cairo_gstate_t **freelist)
top = *freelist;
if (top == NULL) {
top = malloc (sizeof (cairo_gstate_t));
top = _cairo_malloc (sizeof (cairo_gstate_t));
if (unlikely (top == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
} else

View file

@ -164,7 +164,7 @@ _cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal)
{
cairo_hash_table_t *hash_table;
hash_table = malloc (sizeof (cairo_hash_table_t));
hash_table = _cairo_malloc (sizeof (cairo_hash_table_t));
if (unlikely (hash_table == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return NULL;

View file

@ -2934,7 +2934,7 @@ inplace_renderer_init (cairo_image_span_renderer_t *r,
/* Create an effectively unbounded mask by repeating the single line */
buf = r->_buf;
if (width > SZ_BUF) {
buf = malloc (width);
buf = _cairo_malloc (width);
if (unlikely (buf == NULL)) {
pixman_image_unref (r->src);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -872,7 +872,7 @@ create_separable_convolution (int *n_values,
size_y = (1 << ysubsample) * ywidth;
*n_values = 4 + size_x + size_y;
params = malloc (*n_values * sizeof (pixman_fixed_t));
params = _cairo_malloc (*n_values * sizeof (pixman_fixed_t));
if (!params) return 0;
params[0] = pixman_int_to_fixed (xwidth);
@ -1077,7 +1077,7 @@ attach_proxy (cairo_surface_t *source,
{
struct proxy *proxy;
proxy = malloc (sizeof (*proxy));
proxy = _cairo_malloc (sizeof (*proxy));
if (unlikely (proxy == NULL))
return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY);
@ -1407,7 +1407,7 @@ _pixman_image_for_surface (cairo_image_surface_t *dst,
return NULL;
}
cleanup = malloc (sizeof (*cleanup));
cleanup = _cairo_malloc (sizeof (*cleanup));
if (unlikely (cleanup == NULL)) {
_cairo_surface_release_source_image (pattern->surface, image, extra);
pixman_image_unref (pixman_image);
@ -1498,7 +1498,7 @@ _pixman_image_for_raster (cairo_image_surface_t *dst,
return NULL;
}
cleanup = malloc (sizeof (*cleanup));
cleanup = _cairo_malloc (sizeof (*cleanup));
if (unlikely (cleanup == NULL)) {
pixman_image_unref (pixman_image);
_cairo_surface_release_source_image (surface, image, extra);
@ -1594,7 +1594,7 @@ _cairo_image_source_create_for_pattern (cairo_surface_t *dst,
TRACE ((stderr, "%s\n", __FUNCTION__));
source = malloc (sizeof (cairo_image_source_t));
source = _cairo_malloc (sizeof (cairo_image_source_t));
if (unlikely (source == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -182,7 +182,7 @@ _cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image,
{
cairo_image_surface_t *surface;
surface = malloc (sizeof (cairo_image_surface_t));
surface = _cairo_malloc (sizeof (cairo_image_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -73,7 +73,7 @@ _lzw_buf_init (lzw_buf_t *buf, int size)
buf->pending = 0;
buf->pending_bits = 0;
buf->data = malloc (size);
buf->data = _cairo_malloc (size);
if (unlikely (buf->data == NULL)) {
buf->data_size = 0;
buf->status = _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -316,7 +316,7 @@ _cairo_mempool_init (cairo_mempool_t *pool,
for (i = 0; i < ARRAY_LENGTH (pool->free); i++)
cairo_list_init (&pool->free[i]);
pool->map = malloc ((num_blocks + 7) >> 3);
pool->map = _cairo_malloc ((num_blocks + 7) >> 3);
if (pool->map == NULL) {
free (pool->blocks);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -1069,7 +1069,7 @@ _cairo_intern_string (const char **str_inout, int len)
istring = _cairo_hash_table_lookup (_cairo_intern_string_ht,
&tmpl.hash_entry);
if (istring == NULL) {
istring = malloc (sizeof (cairo_intern_string_t) + len + 1);
istring = _cairo_malloc (sizeof (cairo_intern_string_t) + len + 1);
if (likely (istring != NULL)) {
istring->hash_entry.hash = tmpl.hash_entry.hash;
istring->len = tmpl.len;

View file

@ -587,7 +587,7 @@ _cairo_mono_scan_converter_create (int xmin,
cairo_mono_scan_converter_t *self;
cairo_status_t status;
self = malloc (sizeof(struct _cairo_mono_scan_converter));
self = _cairo_malloc (sizeof(struct _cairo_mono_scan_converter));
if (unlikely (self == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto bail_nomem;

View file

@ -198,7 +198,7 @@ void *_buffer_alloc (size_t a, size_t b, const unsigned int size)
return NULL;
#else
/* Clear the malloc'd buffer the way DosAllocMem() does. */
buffer = malloc (nbytes);
buffer = _cairo_malloc (nbytes);
if (buffer) {
memset (buffer, 0, nbytes);
}
@ -718,7 +718,7 @@ cairo_os2_surface_create (HPS hps_client_window,
}
/* Allocate an OS/2 surface structure. */
local_os2_surface = (cairo_os2_surface_t *) malloc (sizeof (cairo_os2_surface_t));
local_os2_surface = (cairo_os2_surface_t *) _cairo_malloc (sizeof (cairo_os2_surface_t));
if (!local_os2_surface) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto error_exit;

View file

@ -147,7 +147,7 @@ _cairo_output_stream_create (cairo_write_func_t write_func,
{
cairo_output_stream_with_closure_t *stream;
stream = malloc (sizeof (cairo_output_stream_with_closure_t));
stream = _cairo_malloc (sizeof (cairo_output_stream_with_closure_t));
if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
@ -173,7 +173,7 @@ _cairo_output_stream_create_in_error (cairo_status_t status)
if (status == CAIRO_STATUS_WRITE_ERROR)
return (cairo_output_stream_t *) &_cairo_output_stream_nil_write_error;
stream = malloc (sizeof (cairo_output_stream_t));
stream = _cairo_malloc (sizeof (cairo_output_stream_t));
if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
@ -639,7 +639,7 @@ _cairo_output_stream_create_for_file (FILE *file)
return (cairo_output_stream_t *) &_cairo_output_stream_nil_write_error;
}
stream = malloc (sizeof *stream);
stream = _cairo_malloc (sizeof *stream);
if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
@ -678,7 +678,7 @@ _cairo_output_stream_create_for_filename (const char *filename)
}
}
stream = malloc (sizeof *stream);
stream = _cairo_malloc (sizeof *stream);
if (unlikely (stream == NULL)) {
fclose (file);
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
@ -722,7 +722,7 @@ _cairo_memory_stream_create (void)
{
memory_stream_t *stream;
stream = malloc (sizeof *stream);
stream = _cairo_malloc (sizeof *stream);
if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
@ -749,7 +749,7 @@ _cairo_memory_stream_destroy (cairo_output_stream_t *abstract_stream,
stream = (memory_stream_t *) abstract_stream;
*length_out = _cairo_array_num_elements (&stream->array);
*data_out = malloc (*length_out);
*data_out = _cairo_malloc (*length_out);
if (unlikely (*data_out == NULL)) {
status = _cairo_output_stream_destroy (abstract_stream);
assert (status == CAIRO_STATUS_SUCCESS);
@ -799,7 +799,7 @@ _cairo_null_stream_create (void)
{
cairo_output_stream_t *stream;
stream = malloc (sizeof *stream);
stream = _cairo_malloc (sizeof *stream);
if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;

View file

@ -98,7 +98,7 @@ _cairo_paginated_surface_create (cairo_surface_t *target,
cairo_paginated_surface_t *surface;
cairo_status_t status;
surface = malloc (sizeof (cairo_paginated_surface_t));
surface = _cairo_malloc (sizeof (cairo_paginated_surface_t));
if (unlikely (surface == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto FAIL;

View file

@ -325,7 +325,7 @@ _cairo_path_fixed_create (void)
{
cairo_path_fixed_t *path;
path = malloc (sizeof (cairo_path_fixed_t));
path = _cairo_malloc (sizeof (cairo_path_fixed_t));
if (!path) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return NULL;

View file

@ -294,7 +294,7 @@ _cairo_path_create_in_error (cairo_status_t status)
if (status == CAIRO_STATUS_NO_MEMORY)
return (cairo_path_t*) &_cairo_path_nil;
path = malloc (sizeof (cairo_path_t));
path = _cairo_malloc (sizeof (cairo_path_t));
if (unlikely (path == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_path_t*) &_cairo_path_nil;
@ -314,7 +314,7 @@ _cairo_path_create_internal (cairo_path_fixed_t *path_fixed,
{
cairo_path_t *path;
path = malloc (sizeof (cairo_path_t));
path = _cairo_malloc (sizeof (cairo_path_t));
if (unlikely (path == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_path_t*) &_cairo_path_nil;

View file

@ -498,22 +498,22 @@ _cairo_pattern_create_copy (cairo_pattern_t **pattern_out,
switch (other->type) {
case CAIRO_PATTERN_TYPE_SOLID:
pattern = malloc (sizeof (cairo_solid_pattern_t));
pattern = _cairo_malloc (sizeof (cairo_solid_pattern_t));
break;
case CAIRO_PATTERN_TYPE_SURFACE:
pattern = malloc (sizeof (cairo_surface_pattern_t));
pattern = _cairo_malloc (sizeof (cairo_surface_pattern_t));
break;
case CAIRO_PATTERN_TYPE_LINEAR:
pattern = malloc (sizeof (cairo_linear_pattern_t));
pattern = _cairo_malloc (sizeof (cairo_linear_pattern_t));
break;
case CAIRO_PATTERN_TYPE_RADIAL:
pattern = malloc (sizeof (cairo_radial_pattern_t));
pattern = _cairo_malloc (sizeof (cairo_radial_pattern_t));
break;
case CAIRO_PATTERN_TYPE_MESH:
pattern = malloc (sizeof (cairo_mesh_pattern_t));
pattern = _cairo_malloc (sizeof (cairo_mesh_pattern_t));
break;
case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
pattern = malloc (sizeof (cairo_raster_source_pattern_t));
pattern = _cairo_malloc (sizeof (cairo_raster_source_pattern_t));
break;
default:
ASSERT_NOT_REACHED;
@ -604,7 +604,7 @@ _cairo_pattern_create_solid (const cairo_color_t *color)
_freed_pool_get (&freed_pattern_pool[CAIRO_PATTERN_TYPE_SOLID]);
if (unlikely (pattern == NULL)) {
/* None cached, need to create a new pattern. */
pattern = malloc (sizeof (cairo_solid_pattern_t));
pattern = _cairo_malloc (sizeof (cairo_solid_pattern_t));
if (unlikely (pattern == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_pattern_t *) &_cairo_pattern_nil;
@ -738,7 +738,7 @@ cairo_pattern_create_for_surface (cairo_surface_t *surface)
pattern =
_freed_pool_get (&freed_pattern_pool[CAIRO_PATTERN_TYPE_SURFACE]);
if (unlikely (pattern == NULL)) {
pattern = malloc (sizeof (cairo_surface_pattern_t));
pattern = _cairo_malloc (sizeof (cairo_surface_pattern_t));
if (unlikely (pattern == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_pattern_t *)&_cairo_pattern_nil.base;
@ -790,7 +790,7 @@ cairo_pattern_create_linear (double x0, double y0, double x1, double y1)
pattern =
_freed_pool_get (&freed_pattern_pool[CAIRO_PATTERN_TYPE_LINEAR]);
if (unlikely (pattern == NULL)) {
pattern = malloc (sizeof (cairo_linear_pattern_t));
pattern = _cairo_malloc (sizeof (cairo_linear_pattern_t));
if (unlikely (pattern == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_pattern_t *) &_cairo_pattern_nil.base;
@ -844,7 +844,7 @@ cairo_pattern_create_radial (double cx0, double cy0, double radius0,
pattern =
_freed_pool_get (&freed_pattern_pool[CAIRO_PATTERN_TYPE_RADIAL]);
if (unlikely (pattern == NULL)) {
pattern = malloc (sizeof (cairo_radial_pattern_t));
pattern = _cairo_malloc (sizeof (cairo_radial_pattern_t));
if (unlikely (pattern == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_pattern_t *) &_cairo_pattern_nil.base;
@ -1022,7 +1022,7 @@ cairo_pattern_create_mesh (void)
pattern =
_freed_pool_get (&freed_pattern_pool[CAIRO_PATTERN_TYPE_MESH]);
if (unlikely (pattern == NULL)) {
pattern = malloc (sizeof (cairo_mesh_pattern_t));
pattern = _cairo_malloc (sizeof (cairo_mesh_pattern_t));
if (unlikely (pattern == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_pattern_t *) &_cairo_pattern_nil.base;
@ -4480,7 +4480,7 @@ cairo_mesh_pattern_get_path (cairo_pattern_t *pattern,
patch = _cairo_array_index_const (&mesh->patches, patch_num);
path = malloc (sizeof (cairo_path_t));
path = _cairo_malloc (sizeof (cairo_path_t));
if (path == NULL)
return _cairo_path_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -100,7 +100,7 @@ add_tree_node (cairo_pdf_surface_t *surface,
{
cairo_pdf_struct_tree_node_t *node;
node = malloc (sizeof(cairo_pdf_struct_tree_node_t));
node = _cairo_malloc (sizeof(cairo_pdf_struct_tree_node_t));
if (unlikely (node == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -359,7 +359,7 @@ _word_wrap_stream_create (cairo_output_stream_t *output, cairo_bool_t ps, int ma
if (output->status)
return _cairo_output_stream_create_in_error (output->status);
stream = malloc (sizeof (word_wrap_stream_t));
stream = _cairo_malloc (sizeof (word_wrap_stream_t));
if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;

View file

@ -170,7 +170,7 @@ _cairo_pdf_shading_generate_data (cairo_pdf_shading_t *shading,
* 4 colors. Each color is stored in 2 bytes * num_color_components.
*/
shading->data_length = num_patches * (1 + 16 * 2 * 4 + 4 * 2 * num_color_components);
shading->data = malloc (shading->data_length);
shading->data = _cairo_malloc (shading->data_length);
if (unlikely (shading->data == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -397,7 +397,7 @@ _cairo_pdf_surface_create_for_stream_internal (cairo_output_stream_t *output,
cairo_pdf_surface_t *surface;
cairo_status_t status, status_ignored;
surface = malloc (sizeof (cairo_pdf_surface_t));
surface = _cairo_malloc (sizeof (cairo_pdf_surface_t));
if (unlikely (surface == NULL)) {
/* destroy stream on behalf of caller */
status = _cairo_output_stream_destroy (output);
@ -1591,7 +1591,7 @@ _cairo_pdf_surface_add_source_surface (cairo_pdf_surface_t *surface,
unique_id_length = 0;
}
surface_entry = malloc (sizeof (cairo_pdf_source_surface_entry_t));
surface_entry = _cairo_malloc (sizeof (cairo_pdf_source_surface_entry_t));
if (surface_entry == NULL) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail1;
@ -2875,7 +2875,7 @@ _cairo_pdf_surface_lookup_jbig2_global (cairo_pdf_surface_t *surface,
}
}
global.id = malloc(global_id_length);
global.id = _cairo_malloc (global_id_length);
if (unlikely (global.id == NULL)) {
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
@ -5166,7 +5166,7 @@ _cairo_utf8_to_pdf_string (const char *utf8, char **str_out)
}
if (ascii) {
str = malloc (len + 3);
str = _cairo_malloc (len + 3);
if (str == NULL)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -5183,7 +5183,7 @@ _cairo_utf8_to_pdf_string (const char *utf8, char **str_out)
if (unlikely (status))
return status;
str = malloc (utf16_len*4 + 7);
str = _cairo_malloc (utf16_len*4 + 7);
if (str == NULL) {
free (utf16);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -8332,7 +8332,7 @@ _cairo_pdf_surface_show_text_glyphs (void *abstract_surface,
group->source_res = pattern_res;
if (utf8_len) {
group->utf8 = malloc (utf8_len);
group->utf8 = _cairo_malloc (utf8_len);
if (unlikely (group->utf8 == NULL)) {
_cairo_pdf_smask_group_destroy (group);
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -1103,7 +1103,7 @@ _cairo_ps_surface_get_page_media (cairo_ps_surface_t *surface)
}
}
page = malloc (sizeof (cairo_page_media_t));
page = _cairo_malloc (sizeof (cairo_page_media_t));
if (unlikely (page == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return NULL;
@ -1139,7 +1139,7 @@ _cairo_ps_surface_create_for_stream_internal (cairo_output_stream_t *stream,
cairo_status_t status, status_ignored;
cairo_ps_surface_t *surface;
surface = malloc (sizeof (cairo_ps_surface_t));
surface = _cairo_malloc (sizeof (cairo_ps_surface_t));
if (unlikely (surface == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP;
@ -2378,7 +2378,7 @@ _base85_strings_stream_create (cairo_output_stream_t *output)
{
string_array_stream_t *stream;
stream = malloc (sizeof (string_array_stream_t));
stream = _cairo_malloc (sizeof (string_array_stream_t));
if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
@ -2408,7 +2408,7 @@ _base85_wrap_stream_create (cairo_output_stream_t *output)
{
string_array_stream_t *stream;
stream = malloc (sizeof (string_array_stream_t));
stream = _cairo_malloc (sizeof (string_array_stream_t));
if (unlikely (stream == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_output_stream_t *) &_cairo_output_stream_nil;
@ -2673,7 +2673,7 @@ _cairo_ps_surface_emit_image (cairo_ps_surface_t *surface,
if (use_mask)
data_size += (ps_image->width + 7)/8;
data_size *= ps_image->height;
data = malloc (data_size);
data = _cairo_malloc (data_size);
if (unlikely (data == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto bail1;

View file

@ -631,7 +631,7 @@ map_qimage_to_image (QImage *qimg, const cairo_rectangle_int_t *extents)
return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY);
}
surface = (struct _qimage_surface *) malloc (sizeof(*surface));
surface = (struct _qimage_surface *) _cairo_malloc (sizeof(*surface));
if (unlikely (surface == NULL)) {
pixman_image_unref (pixman_image);
delete qimg;
@ -1530,7 +1530,7 @@ cairo_qt_surface_create (QPainter *painter)
{
cairo_qt_surface_t *qs;
qs = (cairo_qt_surface_t *) malloc (sizeof(cairo_qt_surface_t));
qs = (cairo_qt_surface_t *) _cairo_malloc (sizeof(cairo_qt_surface_t));
if (qs == NULL)
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -1569,7 +1569,7 @@ cairo_qt_surface_create_with_qimage (cairo_format_t format,
{
cairo_qt_surface_t *qs;
qs = (cairo_qt_surface_t *) malloc (sizeof(cairo_qt_surface_t));
qs = (cairo_qt_surface_t *) _cairo_malloc (sizeof(cairo_qt_surface_t));
if (qs == NULL)
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -1618,7 +1618,7 @@ cairo_qt_surface_create_with_qpixmap (cairo_content_t content,
if ((content & CAIRO_CONTENT_COLOR) == 0)
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_CONTENT));
qs = (cairo_qt_surface_t *) malloc (sizeof(cairo_qt_surface_t));
qs = (cairo_qt_surface_t *) _cairo_malloc (sizeof(cairo_qt_surface_t));
if (qs == NULL)
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -196,7 +196,7 @@ _cairo_quartz_font_face_create_for_toy (cairo_toy_font_face_t *toy_face,
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
family = toy_face->family;
full_name = malloc (strlen (family) + 64); // give us a bit of room to tack on Bold, Oblique, etc.
full_name = _cairo_malloc (strlen (family) + 64); // give us a bit of room to tack on Bold, Oblique, etc.
/* handle CSS-ish faces */
if (!strcmp(family, "serif") || !strcmp(family, "Times Roman"))
family = "Times";
@ -283,7 +283,7 @@ _cairo_quartz_font_face_scaled_font_create (void *abstract_face,
if (!_cairo_quartz_font_symbols_present)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
font = malloc(sizeof(cairo_quartz_scaled_font_t));
font = _cairo_malloc (sizeof(cairo_quartz_scaled_font_t));
if (font == NULL)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -375,7 +375,7 @@ cairo_quartz_font_face_create_for_cgfont (CGFontRef font)
quartz_font_ensure_symbols();
font_face = malloc (sizeof (cairo_quartz_font_face_t));
font_face = _cairo_malloc (sizeof (cairo_quartz_font_face_t));
if (!font_face) {
cairo_status_t ignore_status;
ignore_status = _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -332,7 +332,7 @@ cairo_quartz_image_surface_create (cairo_surface_t *surface)
if (format != CAIRO_FORMAT_ARGB32 && format != CAIRO_FORMAT_RGB24)
return SURFACE_ERROR_INVALID_FORMAT;
qisurf = malloc(sizeof(cairo_quartz_image_surface_t));
qisurf = _cairo_malloc (sizeof(cairo_quartz_image_surface_t));
if (qisurf == NULL)
return SURFACE_ERROR_NO_MEMORY;

View file

@ -826,7 +826,7 @@ _cairo_surface_to_cgimage (cairo_surface_t *source,
}
}
source_img = malloc (sizeof (quartz_source_image_t));
source_img = _cairo_malloc (sizeof (quartz_source_image_t));
if (unlikely (source_img == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -984,7 +984,7 @@ _cairo_quartz_cairo_repeating_surface_pattern_to_quartz (cairo_quartz_surface_t
if (unlikely (status))
return status;
info = malloc (sizeof (SurfacePatternDrawInfo));
info = _cairo_malloc (sizeof (SurfacePatternDrawInfo));
if (unlikely (!info))
return CAIRO_STATUS_NO_MEMORY;
@ -2253,7 +2253,7 @@ _cairo_quartz_surface_create_internal (CGContextRef cgContext,
quartz_ensure_symbols ();
/* Init the base surface */
surface = malloc (sizeof (cairo_quartz_surface_t));
surface = _cairo_malloc (sizeof (cairo_quartz_surface_t));
if (unlikely (surface == NULL))
return (cairo_quartz_surface_t*) _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -158,7 +158,7 @@ static int bbtree_left_or_right (struct bbtree *bbt,
static struct bbtree *
bbtree_new (const cairo_box_t *box, cairo_command_header_t *chain)
{
struct bbtree *bbt = malloc (sizeof (*bbt));
struct bbtree *bbt = _cairo_malloc (sizeof (*bbt));
if (bbt == NULL)
return NULL;
bbt->extents = *box;
@ -386,7 +386,7 @@ cairo_recording_surface_create (cairo_content_t content,
{
cairo_recording_surface_t *surface;
surface = malloc (sizeof (cairo_recording_surface_t));
surface = _cairo_malloc (sizeof (cairo_recording_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -562,7 +562,7 @@ attach_proxy (cairo_surface_t *source,
{
struct proxy *proxy;
proxy = malloc (sizeof (*proxy));
proxy = _cairo_malloc (sizeof (*proxy));
if (unlikely (proxy == NULL))
return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY);
@ -728,7 +728,7 @@ _cairo_recording_surface_paint (void *abstract_surface,
if (unlikely (status))
return status;
command = malloc (sizeof (cairo_command_paint_t));
command = _cairo_malloc (sizeof (cairo_command_paint_t));
if (unlikely (command == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP_COMPOSITE;
@ -784,7 +784,7 @@ _cairo_recording_surface_mask (void *abstract_surface,
if (unlikely (status))
return status;
command = malloc (sizeof (cairo_command_mask_t));
command = _cairo_malloc (sizeof (cairo_command_mask_t));
if (unlikely (command == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP_COMPOSITE;
@ -852,7 +852,7 @@ _cairo_recording_surface_stroke (void *abstract_surface,
if (unlikely (status))
return status;
command = malloc (sizeof (cairo_command_stroke_t));
command = _cairo_malloc (sizeof (cairo_command_stroke_t));
if (unlikely (command == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP_COMPOSITE;
@ -928,7 +928,7 @@ _cairo_recording_surface_fill (void *abstract_surface,
if (unlikely (status))
return status;
command = malloc (sizeof (cairo_command_fill_t));
command = _cairo_malloc (sizeof (cairo_command_fill_t));
if (unlikely (command == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP_COMPOSITE;
@ -1010,7 +1010,7 @@ _cairo_recording_surface_show_text_glyphs (void *abstract_surface,
if (unlikely (status))
return status;
command = malloc (sizeof (cairo_command_show_text_glyphs_t));
command = _cairo_malloc (sizeof (cairo_command_show_text_glyphs_t));
if (unlikely (command == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP_COMPOSITE;
@ -1034,7 +1034,7 @@ _cairo_recording_surface_show_text_glyphs (void *abstract_surface,
command->num_clusters = num_clusters;
if (utf8_len) {
command->utf8 = malloc (utf8_len);
command->utf8 = _cairo_malloc (utf8_len);
if (unlikely (command->utf8 == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP_ARRAYS;
@ -1192,7 +1192,7 @@ _cairo_recording_surface_copy__paint (cairo_recording_surface_t *surface,
cairo_command_paint_t *command;
cairo_status_t status;
command = malloc (sizeof (*command));
command = _cairo_malloc (sizeof (*command));
if (unlikely (command == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto err;
@ -1226,7 +1226,7 @@ _cairo_recording_surface_copy__mask (cairo_recording_surface_t *surface,
cairo_command_mask_t *command;
cairo_status_t status;
command = malloc (sizeof (*command));
command = _cairo_malloc (sizeof (*command));
if (unlikely (command == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto err;
@ -1267,7 +1267,7 @@ _cairo_recording_surface_copy__stroke (cairo_recording_surface_t *surface,
cairo_command_stroke_t *command;
cairo_status_t status;
command = malloc (sizeof (*command));
command = _cairo_malloc (sizeof (*command));
if (unlikely (command == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto err;
@ -1319,7 +1319,7 @@ _cairo_recording_surface_copy__fill (cairo_recording_surface_t *surface,
cairo_command_fill_t *command;
cairo_status_t status;
command = malloc (sizeof (*command));
command = _cairo_malloc (sizeof (*command));
if (unlikely (command == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto err;
@ -1363,7 +1363,7 @@ _cairo_recording_surface_copy__glyphs (cairo_recording_surface_t *surface,
cairo_command_show_text_glyphs_t *command;
cairo_status_t status;
command = malloc (sizeof (*command));
command = _cairo_malloc (sizeof (*command));
if (unlikely (command == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto err;
@ -1384,7 +1384,7 @@ _cairo_recording_surface_copy__glyphs (cairo_recording_surface_t *surface,
command->num_clusters = src->show_text_glyphs.num_clusters;
if (command->utf8_len) {
command->utf8 = malloc (command->utf8_len);
command->utf8 = _cairo_malloc (command->utf8_len);
if (unlikely (command->utf8 == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto err_arrays;
@ -1560,7 +1560,7 @@ _cairo_recording_surface_snapshot (void *abstract_other)
cairo_recording_surface_t *surface;
cairo_status_t status;
surface = malloc (sizeof (cairo_recording_surface_t));
surface = _cairo_malloc (sizeof (cairo_recording_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -167,7 +167,7 @@ _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));
sub_font_glyph = _cairo_malloc (sizeof (cairo_sub_font_glyph_t));
if (unlikely (sub_font_glyph == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return NULL;
@ -277,7 +277,7 @@ _cairo_sub_font_create (cairo_scaled_font_subsets_t *parent,
cairo_sub_font_t *sub_font;
int i;
sub_font = malloc (sizeof (cairo_sub_font_t));
sub_font = _cairo_malloc (sizeof (cairo_sub_font_t));
if (unlikely (sub_font == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -404,7 +404,7 @@ _cairo_sub_font_glyph_lookup_unicode (cairo_scaled_font_t *scaled_font,
if (unicode != (uint32_t) -1) {
len = _cairo_ucs4_to_utf8 (unicode, buf);
if (len > 0) {
*utf8_out = malloc (len + 1);
*utf8_out = _cairo_malloc (len + 1);
if (unlikely (*utf8_out == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -441,7 +441,7 @@ _cairo_sub_font_glyph_map_to_unicode (cairo_sub_font_glyph_t *sub_font_glyph,
}
} else {
/* No existing mapping. Use the requested mapping */
sub_font_glyph->utf8 = malloc (utf8_len + 1);
sub_font_glyph->utf8 = _cairo_malloc (utf8_len + 1);
if (unlikely (sub_font_glyph->utf8 == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -611,7 +611,7 @@ _cairo_sub_font_map_glyph (cairo_sub_font_t *sub_font,
if (ucs4_len == 1) {
font_unicode = ucs4[0];
free (font_utf8);
font_utf8 = malloc (text_utf8_len + 1);
font_utf8 = _cairo_malloc (text_utf8_len + 1);
if (font_utf8 == NULL) {
free (ucs4);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -762,7 +762,7 @@ _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));
subsets = _cairo_malloc (sizeof (cairo_scaled_font_subsets_t));
if (unlikely (subsets == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return NULL;
@ -1217,7 +1217,7 @@ _cairo_string_init_key (cairo_string_entry_t *key, char *s)
static cairo_status_t
create_string_entry (char *s, cairo_string_entry_t **entry)
{
*entry = malloc (sizeof (cairo_string_entry_t));
*entry = _cairo_malloc (sizeof (cairo_string_entry_t));
if (unlikely (*entry == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -368,7 +368,7 @@ _cairo_scaled_font_map_lock (void)
CAIRO_MUTEX_LOCK (_cairo_scaled_font_map_mutex);
if (cairo_scaled_font_map == NULL) {
cairo_scaled_font_map = malloc (sizeof (cairo_scaled_font_map_t));
cairo_scaled_font_map = _cairo_malloc (sizeof (cairo_scaled_font_map_t));
if (unlikely (cairo_scaled_font_map == NULL))
goto CLEANUP_MUTEX_LOCK;
@ -509,7 +509,7 @@ _cairo_scaled_font_register_placeholder_and_unlock_font_map (cairo_scaled_font_t
if (unlikely (status))
return status;
placeholder_scaled_font = malloc (sizeof (cairo_scaled_font_t));
placeholder_scaled_font = _cairo_malloc (sizeof (cairo_scaled_font_t));
if (unlikely (placeholder_scaled_font == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1226,7 +1226,7 @@ _cairo_scaled_font_create_in_error (cairo_status_t status)
CAIRO_MUTEX_LOCK (_cairo_scaled_font_error_mutex);
scaled_font = _cairo_scaled_font_nil_objects[status];
if (unlikely (scaled_font == NULL)) {
scaled_font = malloc (sizeof (cairo_scaled_font_t));
scaled_font = _cairo_malloc (sizeof (cairo_scaled_font_t));
if (unlikely (scaled_font == NULL)) {
CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_error_mutex);
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
@ -2875,7 +2875,7 @@ _cairo_scaled_font_allocate_glyph (cairo_scaled_font_t *scaled_font,
}
}
page = malloc (sizeof (cairo_scaled_glyph_page_t));
page = _cairo_malloc (sizeof (cairo_scaled_glyph_page_t));
if (unlikely (page == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -263,7 +263,7 @@ _bitmap_next_id (struct _bitmap *b,
b = b->next;
} while (b != NULL);
bb = malloc (sizeof (struct _bitmap));
bb = _cairo_malloc (sizeof (struct _bitmap));
if (unlikely (bb == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1104,7 +1104,7 @@ attach_snapshot (cairo_script_context_t *ctx,
if (! ctx->attach_snapshots)
return;
surface = malloc (sizeof (*surface));
surface = _cairo_malloc (sizeof (*surface));
if (unlikely (surface == NULL))
return;
@ -1255,7 +1255,7 @@ _write_image_surface (cairo_output_stream_t *output,
}
#else
if (stride > ARRAY_LENGTH (row_stack)) {
rowdata = malloc (stride);
rowdata = _cairo_malloc (stride);
if (unlikely (rowdata == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
} else
@ -2178,7 +2178,7 @@ _cairo_script_surface_finish (void *abstract_surface)
}
cairo_list_del (&surface->operand.link);
} else {
struct deferred_finish *link = malloc (sizeof (*link));
struct deferred_finish *link = _cairo_malloc (sizeof (*link));
if (link == NULL) {
status2 = _cairo_error (CAIRO_STATUS_NO_MEMORY);
if (status == CAIRO_STATUS_SUCCESS)
@ -2857,7 +2857,7 @@ _emit_type42_font (cairo_script_surface_t *surface,
if (unlikely (status))
return status;
buf = malloc (size);
buf = _cairo_malloc (size);
if (unlikely (buf == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -2913,7 +2913,7 @@ _emit_scaled_font_init (cairo_script_surface_t *surface,
cairo_script_font_t *font_private;
cairo_int_status_t status;
font_private = malloc (sizeof (cairo_script_font_t));
font_private = _cairo_malloc (sizeof (cairo_script_font_t));
if (unlikely (font_private == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -3643,7 +3643,7 @@ _cairo_script_surface_create_internal (cairo_script_context_t *ctx,
if (unlikely (ctx == NULL))
return (cairo_script_surface_t *) _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NULL_POINTER));
surface = malloc (sizeof (cairo_script_surface_t));
surface = _cairo_malloc (sizeof (cairo_script_surface_t));
if (unlikely (surface == NULL))
return (cairo_script_surface_t *) _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -3692,7 +3692,7 @@ _cairo_script_context_create_internal (cairo_output_stream_t *stream)
{
cairo_script_context_t *ctx;
ctx = malloc (sizeof (cairo_script_context_t));
ctx = _cairo_malloc (sizeof (cairo_script_context_t));
if (unlikely (ctx == NULL))
return _cairo_device_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -1043,7 +1043,7 @@ _cairo_skia_surface_create_internal (SkBitmap::Config config,
cairo_skia_surface_t *surface;
cairo_format_t format;
surface = (cairo_skia_surface_t *) malloc (sizeof (cairo_skia_surface_t));
surface = (cairo_skia_surface_t *) _cairo_malloc (sizeof (cairo_skia_surface_t));
if (surface == NULL)
return (cairo_skia_surface_t *) _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -348,7 +348,7 @@ _cairo_device_create_observer_internal (cairo_device_t *target,
cairo_device_observer_t *device;
cairo_status_t status;
device = malloc (sizeof (cairo_device_observer_t));
device = _cairo_malloc (sizeof (cairo_device_observer_t));
if (unlikely (device == NULL))
return _cairo_device_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -379,7 +379,7 @@ _cairo_surface_create_observer_internal (cairo_device_t *device,
cairo_surface_observer_t *surface;
cairo_status_t status;
surface = malloc (sizeof (cairo_surface_observer_t));
surface = _cairo_malloc (sizeof (cairo_surface_observer_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -1418,7 +1418,7 @@ _cairo_surface_observer_add_callback (cairo_list_t *head,
{
struct callback_list *cb;
cb = malloc (sizeof (*cb));
cb = _cairo_malloc (sizeof (*cb));
if (unlikely (cb == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -99,7 +99,7 @@ _cairo_surface_snapshot_acquire_source_image (void *abstract_
struct snapshot_extra *extra;
cairo_status_t status;
extra = malloc (sizeof (*extra));
extra = _cairo_malloc (sizeof (*extra));
if (unlikely (extra == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -258,7 +258,7 @@ _cairo_surface_snapshot (cairo_surface_t *surface)
if (snapshot != NULL)
return cairo_surface_reference (&snapshot->base);
snapshot = malloc (sizeof (cairo_surface_snapshot_t));
snapshot = _cairo_malloc (sizeof (cairo_surface_snapshot_t));
if (unlikely (snapshot == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_FINISHED));

View file

@ -462,7 +462,7 @@ cairo_surface_create_for_rectangle (cairo_surface_t *target,
if (unlikely (target->finished))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
surface = malloc (sizeof (cairo_surface_subsurface_t));
surface = _cairo_malloc (sizeof (cairo_surface_subsurface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -522,7 +522,7 @@ _cairo_surface_create_for_rectangle_int (cairo_surface_t *target,
assert (target->backend->type != CAIRO_SURFACE_TYPE_SUBSURFACE);
surface = malloc (sizeof (cairo_surface_subsurface_t));
surface = _cairo_malloc (sizeof (cairo_surface_subsurface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -1438,7 +1438,7 @@ cairo_surface_set_mime_data (cairo_surface_t *surface,
return _cairo_surface_set_error (surface, status);
if (data != NULL) {
mime_data = malloc (sizeof (cairo_mime_data_t));
mime_data = _cairo_malloc (sizeof (cairo_mime_data_t));
if (unlikely (mime_data == NULL))
return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -656,7 +656,7 @@ _cairo_svg_surface_create_for_document (cairo_svg_document_t *document,
cairo_surface_t *paginated;
cairo_status_t status, status_ignored;
surface = malloc (sizeof (cairo_svg_surface_t));
surface = _cairo_malloc (sizeof (cairo_svg_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -2862,7 +2862,7 @@ _cairo_svg_document_create (cairo_output_stream_t *output_stream,
if (output_stream->status)
return output_stream->status;
document = malloc (sizeof (cairo_svg_document_t));
document = _cairo_malloc (sizeof (cairo_svg_document_t));
if (unlikely (document == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -267,7 +267,7 @@ parse_string (const char *p, char **s)
if (!end)
return NULL;
*s = malloc (len + 1);
*s = _cairo_malloc (len + 1);
decode_string (p, &len, *s);
(*s)[len] = 0;
@ -341,7 +341,7 @@ parse_name (const char *p, const char **end, char **s)
p2++;
len = p2 - p;
name = malloc (len + 1);
name = _cairo_malloc (len + 1);
if (unlikely (name == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -182,7 +182,7 @@ _cairo_tag_stack_push (cairo_tag_stack_t *stack,
}
}
elem = malloc (sizeof(cairo_tag_stack_elem_t));
elem = _cairo_malloc (sizeof(cairo_tag_stack_elem_t));
if (unlikely (elem == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -428,7 +428,7 @@ cairo_tee_surface_create (cairo_surface_t *master)
if (unlikely (master->status))
return _cairo_surface_create_in_error (master->status);
surface = malloc (sizeof (cairo_tee_surface_t));
surface = _cairo_malloc (sizeof (cairo_tee_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -483,7 +483,7 @@ _pool_chunk_create(struct pool *pool, size_t size)
{
struct _pool_chunk *p;
p = malloc(SIZEOF_POOL_CHUNK + size);
p = _cairo_malloc (SIZEOF_POOL_CHUNK + size);
if (unlikely (NULL == p))
longjmp (*pool->jmp, _cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -1872,7 +1872,7 @@ _cairo_tor_scan_converter_create (int xmin,
cairo_tor_scan_converter_t *self;
cairo_status_t status;
self = malloc (sizeof(struct _cairo_tor_scan_converter));
self = _cairo_malloc (sizeof(struct _cairo_tor_scan_converter));
if (unlikely (self == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto bail_nomem;

View file

@ -504,7 +504,7 @@ _pool_chunk_create(struct pool *pool, size_t size)
{
struct _pool_chunk *p;
p = malloc(size + sizeof(struct _pool_chunk));
p = _cairo_malloc (size + sizeof(struct _pool_chunk));
if (unlikely (NULL == p))
longjmp (*pool->jmp, _cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -1682,7 +1682,7 @@ _cairo_tor22_scan_converter_create (int xmin,
cairo_tor22_scan_converter_t *self;
cairo_status_t status;
self = malloc (sizeof(struct _cairo_tor22_scan_converter));
self = _cairo_malloc (sizeof(struct _cairo_tor22_scan_converter));
if (unlikely (self == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto bail_nomem;

View file

@ -312,7 +312,7 @@ cairo_toy_font_face_create (const char *family,
}
/* Otherwise create it and insert into hash table. */
font_face = malloc (sizeof (cairo_toy_font_face_t));
font_face = _cairo_malloc (sizeof (cairo_toy_font_face_t));
if (unlikely (font_face == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto UNWIND_HASH_TABLE_LOCK;

View file

@ -193,7 +193,7 @@ _cairo_truetype_font_create (cairo_scaled_font_subset_t *scaled_font_subset,
if (unlikely (status))
return status;
font = malloc (sizeof (cairo_truetype_font_t));
font = _cairo_malloc (sizeof (cairo_truetype_font_t));
if (unlikely (font == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -246,7 +246,7 @@ _cairo_truetype_font_create (cairo_scaled_font_subset_t *scaled_font_subset,
/* If the PS name is not found, create a CairoFont-x-y name. */
if (font->base.ps_name == NULL) {
font->base.ps_name = malloc (30);
font->base.ps_name = _cairo_malloc (30);
if (unlikely (font->base.ps_name == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail3;
@ -622,7 +622,7 @@ cairo_truetype_font_write_glyf_table (cairo_truetype_font_t *font,
else
size = sizeof (int32_t) * (font->base.num_glyphs_in_face + 1);
u.bytes = malloc (size);
u.bytes = _cairo_malloc (size);
if (unlikely (u.bytes == NULL))
return _cairo_truetype_font_set_error (font, CAIRO_STATUS_NO_MEMORY);
@ -1195,7 +1195,7 @@ cairo_truetype_subset_init_internal (cairo_truetype_subset_t *truetype_subse
truetype_subset->descent = (double)font->base.descent/font->base.units_per_em;
if (length) {
truetype_subset->data = malloc (length);
truetype_subset->data = _cairo_malloc (length);
if (unlikely (truetype_subset->data == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail4;
@ -1208,7 +1208,7 @@ cairo_truetype_subset_init_internal (cairo_truetype_subset_t *truetype_subse
if (num_strings) {
offsets_length = num_strings * sizeof (unsigned long);
truetype_subset->string_offsets = malloc (offsets_length);
truetype_subset->string_offsets = _cairo_malloc (offsets_length);
if (unlikely (truetype_subset->string_offsets == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail5;
@ -1296,7 +1296,7 @@ _cairo_truetype_reverse_cmap (cairo_scaled_font_t *scaled_font,
return CAIRO_INT_STATUS_UNSUPPORTED;
size = be16_to_cpu (map->length);
map = malloc (size);
map = _cairo_malloc (size);
if (unlikely (map == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1462,7 +1462,7 @@ find_name (tt_name_t *name, int name_id, int platform, int encoding, int languag
if (len > MAX_FONT_NAME_LENGTH)
break;
str = malloc (len + 1);
str = _cairo_malloc (len + 1);
if (str == NULL)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1488,7 +1488,7 @@ find_name (tt_name_t *name, int name_id, int platform, int encoding, int languag
for (i = 0; i < u_len; i++)
size += _cairo_ucs4_to_utf8 (be16_to_cpu(u[i]), NULL);
utf8 = malloc (size + 1);
utf8 = _cairo_malloc (size + 1);
if (utf8 == NULL) {
status =_cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail;
@ -1523,7 +1523,7 @@ find_name (tt_name_t *name, int name_id, int platform, int encoding, int languag
}
}
if (has_tag) {
p = malloc (len - 6);
p = _cairo_malloc (len - 6);
if (unlikely (p == NULL)) {
status =_cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail;
@ -1568,7 +1568,7 @@ _cairo_truetype_read_font_name (cairo_scaled_font_t *scaled_font,
if (status)
return status;
name = malloc (size);
name = _cairo_malloc (size);
if (name == NULL)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -760,7 +760,7 @@ _cairo_type1_fallback_init_internal (cairo_type1_subset_t *type1_subset,
length = font->header_size + font->data_size +
font->trailer_size;
type1_subset->data = malloc (length);
type1_subset->data = _cairo_malloc (length);
if (unlikely (type1_subset->data == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail3;

View file

@ -326,7 +326,7 @@ cairo_type1_font_subset_get_matrix (cairo_type1_font_subset_t *font,
return CAIRO_INT_STATUS_UNSUPPORTED;
s_max = end - start + 5*decimal_point_len + 1;
s = malloc (s_max);
s = _cairo_malloc (s_max);
if (unlikely (s == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -420,7 +420,7 @@ cairo_type1_font_subset_get_fontname (cairo_type1_font_subset_t *font)
while (end > start && _cairo_isspace(end[-1]))
end--;
s = malloc (end - start + 1);
s = _cairo_malloc (end - start + 1);
if (unlikely (s == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -624,7 +624,7 @@ cairo_type1_font_subset_decrypt_eexec_segment (cairo_type1_font_subset_t *font)
in = (unsigned char *) font->eexec_segment;
end = (unsigned char *) in + font->eexec_segment_size;
font->cleartext = malloc (font->eexec_segment_size + 1);
font->cleartext = _cairo_malloc (font->eexec_segment_size + 1);
if (unlikely (font->cleartext == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -783,7 +783,7 @@ cairo_type1_font_subset_parse_charstring (cairo_type1_font_subset_t *font,
const unsigned char *p;
int command;
charstring = malloc (encrypted_charstring_length);
charstring = _cairo_malloc (encrypted_charstring_length);
if (unlikely (charstring == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1096,7 +1096,7 @@ cairo_type1_font_subset_build_glyph_list (cairo_type1_font_subset_t *font,
glyph_data_t glyph;
cairo_status_t status;
s = malloc (name_length + 1);
s = _cairo_malloc (name_length + 1);
if (unlikely (s == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1285,7 +1285,7 @@ cairo_type1_font_subset_write_private_dict (cairo_type1_font_subset_t *font,
if (lenIV_end == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;
lenIV_str = malloc (lenIV_end - lenIV_start + 1);
lenIV_str = _cairo_malloc (lenIV_end - lenIV_start + 1);
if (unlikely (lenIV_str == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1642,7 +1642,7 @@ cairo_type1_font_subset_generate (void *abstract_font,
return CAIRO_INT_STATUS_UNSUPPORTED;
font->type1_length = data_length;
font->type1_data = malloc (font->type1_length);
font->type1_data = _cairo_malloc (font->type1_length);
if (unlikely (font->type1_data == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1768,7 +1768,7 @@ _cairo_type1_subset_init (cairo_type1_subset_t *type1_subset,
length = font.base.header_size +
font.base.data_size +
font.base.trailer_size;
type1_subset->data = malloc (length);
type1_subset->data = _cairo_malloc (length);
if (unlikely (type1_subset->data == NULL))
goto fail3;

View file

@ -82,7 +82,7 @@ _cairo_type3_glyph_surface_create (cairo_scaled_font_t *scaled_font,
if (unlikely (stream != NULL && stream->status))
return _cairo_surface_create_in_error (stream->status);
surface = malloc (sizeof (cairo_type3_glyph_surface_t));
surface = _cairo_malloc (sizeof (cairo_type3_glyph_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -402,7 +402,7 @@ _cairo_user_font_face_scaled_font_create (void *abstract_
font_face->immutable = TRUE;
user_scaled_font = malloc (sizeof (cairo_user_scaled_font_t));
user_scaled_font = _cairo_malloc (sizeof (cairo_user_scaled_font_t));
if (unlikely (user_scaled_font == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -544,7 +544,7 @@ cairo_user_font_face_create (void)
{
cairo_user_font_face_t *font_face;
font_face = malloc (sizeof (cairo_user_font_face_t));
font_face = _cairo_malloc (sizeof (cairo_user_font_face_t));
if (!font_face) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_font_face_t *)&_cairo_font_face_nil;

View file

@ -1517,7 +1517,7 @@ _vg_surface_create_internal (cairo_vg_context_t *context,
{
cairo_vg_surface_t *surface;
surface = malloc (sizeof (cairo_vg_surface_t));
surface = _cairo_malloc (sizeof (cairo_vg_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -1712,7 +1712,7 @@ cairo_vg_context_create_for_glx (Display *dpy, GLXContext ctx)
cairo_vg_context_t *context;
cairo_status_t status;
context = malloc (sizeof (*context));
context = _cairo_malloc (sizeof (*context));
if (unlikely (context == NULL))
return (cairo_vg_context_t *) &_vg_context_nil;
@ -1817,7 +1817,7 @@ cairo_vg_context_create_for_egl (EGLDisplay egl_display,
cairo_vg_context_t *context;
cairo_status_t status;
context = malloc (sizeof (*context));
context = _cairo_malloc (sizeof (*context));
if (unlikely (context == NULL))
return (cairo_vg_context_t *) &_vg_context_nil;

View file

@ -111,7 +111,7 @@ _cairo_xcb_connection_find_visual_formats (cairo_xcb_connection_t *connection,
cairo_xcb_xrender_format_t *f;
cairo_status_t status;
f = malloc (sizeof (cairo_xcb_xrender_format_t));
f = _cairo_malloc (sizeof (cairo_xcb_xrender_format_t));
if (unlikely (f == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -177,7 +177,7 @@ _cairo_xcb_connection_parse_xrender_formats (cairo_xcb_connection_t *connection,
if (! _cairo_hash_table_lookup (connection->xrender_formats, &key)) {
cairo_xcb_xrender_format_t *f;
f = malloc (sizeof (cairo_xcb_xrender_format_t));
f = _cairo_malloc (sizeof (cairo_xcb_xrender_format_t));
if (unlikely (f == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -634,7 +634,7 @@ _cairo_xcb_connection_get (xcb_connection_t *xcb_connection)
}
}
connection = malloc (sizeof (cairo_xcb_connection_t));
connection = _cairo_malloc (sizeof (cairo_xcb_connection_t));
if (unlikely (connection == NULL))
goto unlock;

View file

@ -249,7 +249,7 @@ _cairo_xcb_screen_get (xcb_connection_t *xcb_connection,
}
}
screen = malloc (sizeof (cairo_xcb_screen_t));
screen = _cairo_malloc (sizeof (cairo_xcb_screen_t));
if (unlikely (screen == NULL))
goto unlock;

View file

@ -209,7 +209,7 @@ _cairo_xcb_connection_allocate_shm_info (cairo_xcb_connection_t *connection,
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
pool = malloc (sizeof (cairo_xcb_shm_mem_pool_t));
pool = _cairo_malloc (sizeof (cairo_xcb_shm_mem_pool_t));
if (unlikely (pool == NULL)) {
CAIRO_MUTEX_UNLOCK (connection->shm_mutex);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -85,7 +85,7 @@ _cairo_xcb_pixmap_create (cairo_xcb_surface_t *target,
{
cairo_xcb_pixmap_t *surface;
surface = malloc (sizeof (cairo_xcb_pixmap_t));
surface = _cairo_malloc (sizeof (cairo_xcb_pixmap_t));
if (unlikely (surface == NULL))
return (cairo_xcb_pixmap_t *)
_cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -119,7 +119,7 @@ _cairo_xcb_pixmap_copy (cairo_xcb_surface_t *target)
{
cairo_xcb_pixmap_t *surface;
surface = malloc (sizeof (cairo_xcb_pixmap_t));
surface = _cairo_malloc (sizeof (cairo_xcb_pixmap_t));
if (unlikely (surface == NULL))
return (cairo_xcb_pixmap_t *)
_cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -114,7 +114,7 @@ _cairo_xcb_picture_create (cairo_xcb_screen_t *screen,
{
cairo_xcb_picture_t *surface;
surface = malloc (sizeof (cairo_xcb_picture_t));
surface = _cairo_malloc (sizeof (cairo_xcb_picture_t));
if (unlikely (surface == NULL))
return (cairo_xcb_picture_t *)
_cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -4141,7 +4141,7 @@ _cairo_xcb_font_create (cairo_xcb_connection_t *connection,
cairo_xcb_font_t *priv;
int i;
priv = malloc (sizeof (cairo_xcb_font_t));
priv = _cairo_malloc (sizeof (cairo_xcb_font_t));
if (unlikely (priv == NULL))
return NULL;
@ -4334,7 +4334,7 @@ _cairo_xcb_glyph_fini (cairo_scaled_glyph_private_t *glyph_private,
}
if (to_free == NULL) {
to_free = malloc (sizeof (cairo_xcb_font_glyphset_free_glyphs_t));
to_free = _cairo_malloc (sizeof (cairo_xcb_font_glyphset_free_glyphs_t));
if (unlikely (to_free == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return; /* XXX cannot propagate failure */
@ -4361,7 +4361,7 @@ _cairo_xcb_glyph_attach (cairo_xcb_connection_t *c,
{
cairo_xcb_glyph_private_t *priv;
priv = malloc (sizeof (*priv));
priv = _cairo_malloc (sizeof (*priv));
if (unlikely (priv == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -4472,7 +4472,7 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection,
if (c == 0)
break;
new = malloc (c);
new = _cairo_malloc (c);
if (unlikely (new == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto BAIL;
@ -4503,7 +4503,7 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection,
if (c == 0)
break;
new = malloc (4 * c);
new = _cairo_malloc (4 * c);
if (unlikely (new == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto BAIL;
@ -4585,7 +4585,7 @@ _emit_glyphs_chunk (cairo_xcb_surface_t *dst,
int i;
if (estimated_req_size > ARRAY_LENGTH (stack_buf)) {
buf = malloc (estimated_req_size);
buf = _cairo_malloc (estimated_req_size);
if (unlikely (buf == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}

View file

@ -1075,7 +1075,7 @@ _cairo_xcb_surface_create_internal (cairo_xcb_screen_t *screen,
{
cairo_xcb_surface_t *surface;
surface = malloc (sizeof (cairo_xcb_surface_t));
surface = _cairo_malloc (sizeof (cairo_xcb_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -207,7 +207,7 @@ _cairo_xlib_device_create (Display *dpy)
}
}
display = malloc (sizeof (cairo_xlib_display_t));
display = _cairo_malloc (sizeof (cairo_xlib_display_t));
if (unlikely (display == NULL)) {
device = _cairo_device_create_in_error (CAIRO_STATUS_NO_MEMORY);
goto UNLOCK;

View file

@ -989,7 +989,7 @@ _cairo_xlib_font_create (cairo_xlib_display_t *display,
cairo_xlib_font_t *priv;
int i;
priv = malloc (sizeof (cairo_xlib_font_t));
priv = _cairo_malloc (sizeof (cairo_xlib_font_t));
if (unlikely (priv == NULL))
return NULL;
@ -1089,7 +1089,7 @@ _cairo_xlib_glyph_attach (cairo_xlib_display_t *display,
{
cairo_xlib_glyph_private_t *priv;
priv = malloc (sizeof (*priv));
priv = _cairo_malloc (sizeof (*priv));
if (unlikely (priv == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1290,7 +1290,7 @@ _cairo_xlib_surface_add_glyph (cairo_xlib_display_t *display,
if (c == 0)
break;
new = malloc (c);
new = _cairo_malloc (c);
if (!new) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto BAIL;
@ -1318,7 +1318,7 @@ _cairo_xlib_surface_add_glyph (cairo_xlib_display_t *display,
if (c == 0)
break;
new = malloc (4 * c);
new = _cairo_malloc (4 * c);
if (unlikely (new == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto BAIL;

View file

@ -330,7 +330,7 @@ _cairo_xlib_screen_get (Display *dpy,
goto CLEANUP_DISPLAY;
}
info = malloc (sizeof (cairo_xlib_screen_t));
info = _cairo_malloc (sizeof (cairo_xlib_screen_t));
if (unlikely (info == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP_DISPLAY;

View file

@ -109,7 +109,7 @@ source (cairo_xlib_surface_t *dst, Picture picture, Pixmap pixmap)
if (picture == None)
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
source = malloc (sizeof (*source));
source = _cairo_malloc (sizeof (*source));
if (unlikely (source == NULL)) {
XRenderFreePicture (dst->display->display, picture);
if (pixmap)
@ -966,7 +966,7 @@ surface_source (cairo_xlib_surface_t *dst,
_cairo_xlib_shm_surface_get_pixmap (src)) {
cairo_xlib_proxy_t *proxy;
proxy = malloc (sizeof(*proxy));
proxy = _cairo_malloc (sizeof(*proxy));
if (unlikely (proxy == NULL))
return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -573,7 +573,7 @@ _cairo_xlib_shm_pool_create(cairo_xlib_display_t *display,
size_t bytes, maxbits = 16, minbits = MIN_BITS;
Status success;
pool = malloc (sizeof (cairo_xlib_shm_t));
pool = _cairo_malloc (sizeof (cairo_xlib_shm_t));
if (pool == NULL)
return NULL;
@ -650,7 +650,7 @@ _cairo_xlib_shm_info_create (cairo_xlib_display_t *display,
assert (mem != NULL);
info = malloc (sizeof (*info));
info = _cairo_malloc (sizeof (*info));
if (info == NULL) {
_cairo_mempool_free (&pool->mem, mem);
return NULL;
@ -814,7 +814,7 @@ _cairo_xlib_shm_surface_create (cairo_xlib_surface_t *other,
if (size < MIN_SIZE)
return NULL;
shm = malloc (sizeof (*shm));
shm = _cairo_malloc (sizeof (*shm));
if (unlikely (shm == NULL))
return (cairo_xlib_shm_surface_t *)_cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY);
@ -1387,7 +1387,7 @@ _cairo_xlib_display_init_shm (cairo_xlib_display_t *display)
if (!can_use_shm (display->display, &has_pixmap))
return;
shm = malloc (sizeof (*shm));
shm = _cairo_malloc (sizeof (*shm));
if (unlikely (shm == NULL))
return;

View file

@ -1766,7 +1766,7 @@ found:
;
}
surface = malloc (sizeof (cairo_xlib_surface_t));
surface = _cairo_malloc (sizeof (cairo_xlib_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -82,7 +82,7 @@ _cairo_xlib_visual_info_create (Display *dpy,
for (i = 0; i < RAMP_SIZE; i++)
ramp_index_to_short[i] = (0xffff * i + ((RAMP_SIZE-1)>>1)) / (RAMP_SIZE-1);
info = malloc (sizeof (cairo_xlib_visual_info_t));
info = _cairo_malloc (sizeof (cairo_xlib_visual_info_t));
if (unlikely (info == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -391,7 +391,7 @@ _cairo_xlib_xcb_device_create (Display *dpy, cairo_device_t *xcb_device)
}
}
display = malloc (sizeof (cairo_xlib_xcb_display_t));
display = _cairo_malloc (sizeof (cairo_xlib_xcb_display_t));
if (unlikely (display == NULL)) {
device = _cairo_device_create_in_error (CAIRO_STATUS_NO_MEMORY);
goto unlock;
@ -438,7 +438,7 @@ _cairo_xlib_xcb_surface_create (void *dpy,
if (unlikely (xcb->status))
return xcb;
surface = malloc (sizeof (*surface));
surface = _cairo_malloc (sizeof (*surface));
if (unlikely (surface == NULL)) {
cairo_surface_destroy (xcb);
return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -258,7 +258,7 @@ _cairo_xml_create_internal (cairo_output_stream_t *stream)
{
cairo_xml_t *xml;
xml = malloc (sizeof (cairo_xml_t));
xml = _cairo_malloc (sizeof (cairo_xml_t));
if (unlikely (xml == NULL))
return _cairo_device_create_in_error (CAIRO_STATUS_NO_MEMORY);
@ -933,7 +933,7 @@ _cairo_xml_emit_type42_font (cairo_xml_t *xml,
if (unlikely (status))
return status;
buf = malloc (size);
buf = _cairo_malloc (size);
if (unlikely (buf == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1098,7 +1098,7 @@ _cairo_xml_surface_create_internal (cairo_device_t *device,
{
cairo_xml_surface_t *surface;
surface = malloc (sizeof (cairo_xml_surface_t));
surface = _cairo_malloc (sizeof (cairo_xml_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -529,7 +529,7 @@ _gallium_fake_bo_create (uint32_t size, uint32_t name)
/* XXX integrate with winsys handle */
bo = malloc (sizeof (cairo_drm_bo_t));
bo = _cairo_malloc (sizeof (cairo_drm_bo_t));
CAIRO_REFERENCE_COUNT_INIT (&bo->ref_count, 1);
bo->name = name;
@ -556,7 +556,7 @@ gallium_surface_create_internal (gallium_device_t *device,
cairo_format_t format;
int stride, size;
surface = malloc (sizeof (gallium_surface_t));
surface = _cairo_malloc (sizeof (gallium_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -641,7 +641,7 @@ gallium_surface_create_for_name (cairo_drm_device_t *base_dev,
cairo_status_t status;
cairo_content_t content;
surface = malloc (sizeof (gallium_surface_t));
surface = _cairo_malloc (sizeof (gallium_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -768,7 +768,7 @@ _cairo_drm_gallium_device_create (int fd, dev_t dev, int vendor_id, int chip_id)
return NULL;
}
device = malloc (sizeof (gallium_device_t));
device = _cairo_malloc (sizeof (gallium_device_t));
if (device == NULL) {
dlclose (handle);
return _cairo_drm_device_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -85,7 +85,7 @@ i915_packed_pixel_surface_create (i915_device_t *device,
if (width > 2048 || height > 2048)
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
surface = malloc (sizeof (i915_packed_pixel_surface_t));
surface = _cairo_malloc (sizeof (i915_packed_pixel_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -98,7 +98,7 @@ i915_accumulate_rectangle (i915_spans_t *spans)
if (unlikely (spans->vbo_offset + size > I915_VBO_SIZE)) {
struct vbo *vbo;
vbo = malloc (sizeof (struct vbo));
vbo = _cairo_malloc (sizeof (struct vbo));
if (unlikely (vbo == NULL)) {
/* throw error! */
}

View file

@ -2432,7 +2432,7 @@ i915_surface_create_internal (cairo_drm_device_t *base_dev,
i915_surface_t *surface;
cairo_status_t status_ignored;
surface = malloc (sizeof (i915_surface_t));
surface = _cairo_malloc (sizeof (i915_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -2542,7 +2542,7 @@ i915_surface_create_for_name (cairo_drm_device_t *base_dev,
break;
}
surface = malloc (sizeof (i915_surface_t));
surface = _cairo_malloc (sizeof (i915_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -2698,7 +2698,7 @@ i915_surface_create_from_cacheable_image_internal (i915_device_t *device,
break;
}
if (node == NULL) {
cache = malloc (sizeof (intel_buffer_cache_t));
cache = _cairo_malloc (sizeof (intel_buffer_cache_t));
if (unlikely (cache == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP_DEVICE;
@ -2735,7 +2735,7 @@ i915_surface_create_from_cacheable_image_internal (i915_device_t *device,
if (unlikely (status))
goto CLEANUP_CACHE;
surface = malloc (sizeof (i915_surface_t));
surface = _cairo_malloc (sizeof (i915_surface_t));
if (unlikely (surface == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP_CACHE;
@ -2879,7 +2879,7 @@ _cairo_drm_i915_device_create (int fd, dev_t dev_id, int vendor_id, int chip_id)
if (! intel_info (fd, &gtt_size))
return NULL;
device = malloc (sizeof (i915_device_t));
device = _cairo_malloc (sizeof (i915_device_t));
if (device == NULL)
return (cairo_drm_device_t *) _cairo_device_create_in_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -71,7 +71,7 @@ i965_glyphs_accumulate_rectangle (i965_glyphs_t *glyphs)
if (unlikely (glyphs->vbo_offset + size > I965_VERTEX_SIZE)) {
struct i965_vbo *vbo;
vbo = malloc (sizeof (struct i965_vbo));
vbo = _cairo_malloc (sizeof (struct i965_vbo));
if (unlikely (vbo == NULL)) {
/* throw error! */
}

View file

@ -87,7 +87,7 @@ i965_spans_accumulate_rectangle (i965_spans_t *spans)
if (unlikely (spans->vbo_offset + size > I965_VERTEX_SIZE)) {
struct i965_vbo *vbo;
vbo = malloc (sizeof (struct i965_vbo));
vbo = _cairo_malloc (sizeof (struct i965_vbo));
if (unlikely (vbo == NULL)) {
/* throw error! */
}

View file

@ -1568,7 +1568,7 @@ i965_surface_create_internal (cairo_drm_device_t *base_dev,
i965_surface_t *surface;
cairo_status_t status_ignored;
surface = malloc (sizeof (i965_surface_t));
surface = _cairo_malloc (sizeof (i965_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -1657,7 +1657,7 @@ i965_surface_create_for_name (cairo_drm_device_t *base_dev,
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
}
surface = malloc (sizeof (i965_surface_t));
surface = _cairo_malloc (sizeof (i965_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -1808,7 +1808,7 @@ _cairo_drm_i965_device_create (int fd, dev_t dev, int vendor_id, int chip_id)
if (! intel_info (fd, &gtt_size))
return NULL;
device = malloc (sizeof (i965_device_t));
device = _cairo_malloc (sizeof (i965_device_t));
if (unlikely (device == NULL))
return (cairo_drm_device_t *) _cairo_device_create_in_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -312,7 +312,7 @@ intel_surface_create (cairo_drm_device_t *device,
intel_surface_t *surface;
cairo_status_t status;
surface = malloc (sizeof (intel_surface_t));
surface = _cairo_malloc (sizeof (intel_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -363,7 +363,7 @@ intel_surface_create_for_name (cairo_drm_device_t *device,
if (stride < cairo_format_stride_for_width (format, width))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
surface = malloc (sizeof (intel_surface_t));
surface = _cairo_malloc (sizeof (intel_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -425,7 +425,7 @@ _cairo_drm_intel_device_create (int fd, dev_t dev, int vendor_id, int chip_id)
if (! intel_info (fd, NULL))
return NULL;
device = malloc (sizeof (intel_device_t));
device = _cairo_malloc (sizeof (intel_device_t));
if (unlikely (device == NULL))
return (cairo_drm_device_t *) _cairo_device_create_in_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -576,7 +576,7 @@ _intel_bo_put_a1_image (intel_device_t *device,
uint8_t *dst;
if (width > (int) sizeof (buf)) {
a8 = malloc (width);
a8 = _cairo_malloc (width);
if (a8 == NULL)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
@ -844,7 +844,7 @@ intel_glyph_cache_add_glyph (intel_device_t *device,
int x;
if (width > (int) sizeof (buf)) {
a8 = malloc (width);
a8 = _cairo_malloc (width);
if (unlikely (a8 == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}

View file

@ -317,7 +317,7 @@ radeon_surface_create_internal (cairo_drm_device_t *device,
radeon_surface_t *surface;
cairo_status_t status;
surface = malloc (sizeof (radeon_surface_t));
surface = _cairo_malloc (sizeof (radeon_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -385,7 +385,7 @@ radeon_surface_create_for_name (cairo_drm_device_t *device,
if (stride < cairo_format_stride_for_width (format, width))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
surface = malloc (sizeof (radeon_surface_t));
surface = _cairo_malloc (sizeof (radeon_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -427,7 +427,7 @@ _cairo_drm_radeon_device_create (int fd, dev_t dev, int vendor_id, int chip_id)
if (! radeon_info (fd, &gart_size, &vram_size))
return NULL;
device = malloc (sizeof (radeon_device_t));
device = _cairo_malloc (sizeof (radeon_device_t));
if (device == NULL)
return _cairo_drm_device_create_in_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -233,7 +233,7 @@ _cairo_skia_surface_create_internal (SkBitmap::Config config,
pixman_format_code_t pixman_format;
SkColorType colorType;
surface = (cairo_skia_surface_t *) malloc (sizeof (cairo_skia_surface_t));
surface = (cairo_skia_surface_t *) _cairo_malloc (sizeof (cairo_skia_surface_t));
if (unlikely (surface == NULL))
return (cairo_skia_surface_t *) _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -78,7 +78,7 @@ test_compositor_surface_create (const cairo_compositor_t *compositor,
if (unlikely (pixman_image == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
surface = malloc (sizeof (test_compositor_surface_t));
surface = _cairo_malloc (sizeof (test_compositor_surface_t));
if (unlikely (surface == NULL)) {
pixman_image_unref (pixman_image);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -81,7 +81,7 @@ test_compositor_surface_create (const cairo_compositor_t *compositor,
if (unlikely (pixman_image == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
surface = malloc (sizeof (test_compositor_surface_t));
surface = _cairo_malloc (sizeof (test_compositor_surface_t));
if (unlikely (surface == NULL)) {
pixman_image_unref (pixman_image);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -74,7 +74,7 @@ _cairo_test_paginated_surface_create (cairo_surface_t *target)
if (unlikely (status))
return _cairo_surface_create_in_error (status);
surface = malloc (sizeof (test_paginated_surface_t));
surface = _cairo_malloc (sizeof (test_paginated_surface_t));
if (unlikely (surface == NULL))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

View file

@ -66,7 +66,7 @@ _cairo_win32_debug_dump_hrgn (HRGN rgn, char *header)
}
z = GetRegionData(rgn, 0, NULL);
rd = (RGNDATA*) malloc(z);
rd = (RGNDATA*) _cairo_malloc (z);
z = GetRegionData(rgn, z, rd);
fprintf (stderr, " %ld rects, bounds: %ld %ld %ld %ld\n",

View file

@ -136,7 +136,7 @@ _cairo_win32_device_get (void)
if (__cairo_win32_device)
return cairo_device_reference (__cairo_win32_device);
device = malloc (sizeof (*device));
device = _cairo_malloc (sizeof (*device));
_cairo_device_init (&device->base, &_cairo_win32_device_backend);

View file

@ -298,7 +298,7 @@ _cairo_win32_display_surface_create_for_dc (HDC original_dc,
unsigned char *bits;
int rowstride;
surface = malloc (sizeof (*surface));
surface = _cairo_malloc (sizeof (*surface));
if (surface == NULL)
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
@ -719,7 +719,7 @@ _cairo_win32_display_surface_set_clip (cairo_win32_display_surface_t *surface,
data_size = sizeof (RGNDATAHEADER) + num_rects * sizeof (RECT);
if (data_size > sizeof (stack)) {
data = malloc (data_size);
data = _cairo_malloc (data_size);
if (!data)
return _cairo_error(CAIRO_STATUS_NO_MEMORY);
} else
@ -988,7 +988,7 @@ cairo_win32_surface_create_with_format (HDC hdc, cairo_format_t format)
break;
}
surface = malloc (sizeof (*surface));
surface = _cairo_malloc (sizeof (*surface));
if (surface == NULL)
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

Some files were not shown because too many files have changed in this diff Show more