diff --git a/boilerplate/xmalloc.c b/boilerplate/xmalloc.c index ddd5cccaf..c2cbe2321 100644 --- a/boilerplate/xmalloc.c +++ b/boilerplate/xmalloc.c @@ -36,7 +36,7 @@ xmalloc (size_t size) void *buf; buf = malloc (size); - if (!buf) { + if (buf == NULL && size != 0) { CAIRO_BOILERPLATE_LOG ("Error: Out of memory. Exiting.\n"); exit (1); } @@ -50,7 +50,7 @@ xcalloc (size_t nmemb, size_t size) void *buf; buf = calloc (nmemb, size); - if (!buf) { + if (buf == NULL && nmemb != 0 && size != 0) { CAIRO_BOILERPLATE_LOG ("Error: Out of memory. Exiting\n"); exit (1); } @@ -62,7 +62,7 @@ void * xrealloc (void *buf, size_t size) { buf = realloc (buf, size); - if (!buf) { + if (buf == NULL && size != 0) { CAIRO_BOILERPLATE_LOG ("Error: Out of memory. Exiting\n"); exit (1); } diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index b9c4748e7..553433c8a 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -922,7 +922,7 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t op, } /* Special case adding trapezoids onto a mask surface; we want to avoid - * creating an intermediate temporary mask unecessarily. + * creating an intermediate temporary mask unnecessarily. * * We make the assumption here that the portion of the trapezoids * contained within the surface is bounded by [dst_x,dst_y,width,height];