mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 20:28:02 +02:00
Add several missing checks for out of memory
This commit is contained in:
parent
cbc1ea78d6
commit
aa40d2e2e1
5 changed files with 62 additions and 12 deletions
14
ChangeLog
14
ChangeLog
|
|
@ -1,3 +1,17 @@
|
|||
2003-11-03 Carl Worth <cworth@isi.edu>
|
||||
|
||||
* src/cairo_ps_surface.c (cairo_set_target_ps): Add missing check
|
||||
for out of memory.
|
||||
|
||||
* src/cairo_image_surface.c
|
||||
(_cairo_image_surface_create_with_masks):
|
||||
(_cairo_image_surface_create_with_masks):
|
||||
(cairo_image_surface_create):
|
||||
(cairo_image_surface_create):
|
||||
(cairo_image_surface_create_for_data):
|
||||
(cairo_image_surface_create_for_data): Add several missing checks
|
||||
for out of memory.
|
||||
|
||||
2003-11-03 Carl Worth <cworth@east.isi.edu>
|
||||
|
||||
* src/cairo.h: Added __external_linkage to a few functions that
|
||||
|
|
|
|||
|
|
@ -85,13 +85,19 @@ _cairo_image_surface_create_with_masks (char *data,
|
|||
format->green_mask,
|
||||
format->blue_mask);
|
||||
|
||||
if (ic_format == NULL)
|
||||
return NULL;
|
||||
|
||||
ic_image = IcImageCreateForData ((IcBits *) data, ic_format,
|
||||
width, height, format->bpp, stride);
|
||||
|
||||
surface = _cairo_image_surface_create_for_ic_image (ic_image);
|
||||
|
||||
IcFormatDestroy (ic_format);
|
||||
|
||||
if (ic_image == NULL)
|
||||
return NULL;
|
||||
|
||||
surface = _cairo_image_surface_create_for_ic_image (ic_image);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
|
|
@ -125,13 +131,18 @@ cairo_image_surface_create (cairo_format_t format,
|
|||
IcImage *ic_image;
|
||||
|
||||
ic_format = _create_ic_format (format);
|
||||
if (ic_format == NULL)
|
||||
return NULL;
|
||||
|
||||
ic_image = IcImageCreate (ic_format, width, height);
|
||||
|
||||
surface = _cairo_image_surface_create_for_ic_image (ic_image);
|
||||
|
||||
IcFormatDestroy (ic_format);
|
||||
|
||||
if (ic_image == NULL)
|
||||
return NULL;
|
||||
|
||||
surface = _cairo_image_surface_create_for_ic_image (ic_image);
|
||||
|
||||
return &surface->base;
|
||||
}
|
||||
|
||||
|
|
@ -147,18 +158,21 @@ cairo_image_surface_create_for_data (char *data,
|
|||
IcImage *ic_image;
|
||||
|
||||
ic_format = _create_ic_format (format);
|
||||
if (ic_format == NULL)
|
||||
return NULL;
|
||||
|
||||
ic_image = IcImageCreateForData ((IcBits *) data, ic_format,
|
||||
width, height,
|
||||
_cairo_format_bpp (format),
|
||||
stride);
|
||||
|
||||
IcFormatDestroy (ic_format);
|
||||
|
||||
if (ic_image == NULL)
|
||||
return NULL;
|
||||
|
||||
surface = _cairo_image_surface_create_for_ic_image (ic_image);
|
||||
|
||||
IcFormatDestroy (ic_format);
|
||||
|
||||
return &surface->base;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ cairo_set_target_ps (cairo_t *cr,
|
|||
surface = cairo_ps_surface_create (file,
|
||||
width_inches, height_inches,
|
||||
x_pixels_per_inch, y_pixels_per_inch);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
|
|
|
|||
|
|
@ -85,13 +85,19 @@ _cairo_image_surface_create_with_masks (char *data,
|
|||
format->green_mask,
|
||||
format->blue_mask);
|
||||
|
||||
if (ic_format == NULL)
|
||||
return NULL;
|
||||
|
||||
ic_image = IcImageCreateForData ((IcBits *) data, ic_format,
|
||||
width, height, format->bpp, stride);
|
||||
|
||||
surface = _cairo_image_surface_create_for_ic_image (ic_image);
|
||||
|
||||
IcFormatDestroy (ic_format);
|
||||
|
||||
if (ic_image == NULL)
|
||||
return NULL;
|
||||
|
||||
surface = _cairo_image_surface_create_for_ic_image (ic_image);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
|
|
@ -125,13 +131,18 @@ cairo_image_surface_create (cairo_format_t format,
|
|||
IcImage *ic_image;
|
||||
|
||||
ic_format = _create_ic_format (format);
|
||||
if (ic_format == NULL)
|
||||
return NULL;
|
||||
|
||||
ic_image = IcImageCreate (ic_format, width, height);
|
||||
|
||||
surface = _cairo_image_surface_create_for_ic_image (ic_image);
|
||||
|
||||
IcFormatDestroy (ic_format);
|
||||
|
||||
if (ic_image == NULL)
|
||||
return NULL;
|
||||
|
||||
surface = _cairo_image_surface_create_for_ic_image (ic_image);
|
||||
|
||||
return &surface->base;
|
||||
}
|
||||
|
||||
|
|
@ -147,18 +158,21 @@ cairo_image_surface_create_for_data (char *data,
|
|||
IcImage *ic_image;
|
||||
|
||||
ic_format = _create_ic_format (format);
|
||||
if (ic_format == NULL)
|
||||
return NULL;
|
||||
|
||||
ic_image = IcImageCreateForData ((IcBits *) data, ic_format,
|
||||
width, height,
|
||||
_cairo_format_bpp (format),
|
||||
stride);
|
||||
|
||||
IcFormatDestroy (ic_format);
|
||||
|
||||
if (ic_image == NULL)
|
||||
return NULL;
|
||||
|
||||
surface = _cairo_image_surface_create_for_ic_image (ic_image);
|
||||
|
||||
IcFormatDestroy (ic_format);
|
||||
|
||||
return &surface->base;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ cairo_set_target_ps (cairo_t *cr,
|
|||
surface = cairo_ps_surface_create (file,
|
||||
width_inches, height_inches,
|
||||
x_pixels_per_inch, y_pixels_per_inch);
|
||||
if (surface == NULL) {
|
||||
cr->status = CAIRO_STATUS_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_target_surface (cr, surface);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue