[cairo-commit] cairo/src cairo_image_surface.c,1.2,1.3 cairo_ps_surface.c,1.2,1.3
Carl Worth
commit at pdx.freedesktop.org
Mon Nov 3 18:24:48 PST 2003
Committed by: cworth
Update of /cvs/cairo/cairo/src
In directory pdx:/tmp/cvs-serv15204/src
Modified Files:
cairo_image_surface.c cairo_ps_surface.c
Log Message:
Add several missing checks for out of memory
Index: cairo_image_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_image_surface.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** cairo_image_surface.c 1 Nov 2003 05:30:35 -0000 1.2
--- cairo_image_surface.c 4 Nov 2003 02:24:45 -0000 1.3
***************
*** 86,96 ****
format->blue_mask);
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);
return surface;
}
--- 86,102 ----
format->blue_mask);
+ if (ic_format == NULL)
+ return NULL;
+
ic_image = IcImageCreateForData ((IcBits *) data, ic_format,
width, height, format->bpp, stride);
IcFormatDestroy (ic_format);
+ if (ic_image == NULL)
+ return NULL;
+
+ surface = _cairo_image_surface_create_for_ic_image (ic_image);
+
return surface;
}
***************
*** 126,136 ****
ic_format = _create_ic_format (format);
ic_image = IcImageCreate (ic_format, width, height);
- surface = _cairo_image_surface_create_for_ic_image (ic_image);
-
IcFormatDestroy (ic_format);
return &surface->base;
}
--- 132,147 ----
ic_format = _create_ic_format (format);
+ if (ic_format == NULL)
+ return NULL;
ic_image = IcImageCreate (ic_format, width, height);
IcFormatDestroy (ic_format);
+ if (ic_image == NULL)
+ return NULL;
+
+ surface = _cairo_image_surface_create_for_ic_image (ic_image);
+
return &surface->base;
}
***************
*** 148,151 ****
--- 159,164 ----
ic_format = _create_ic_format (format);
+ if (ic_format == NULL)
+ return NULL;
ic_image = IcImageCreateForData ((IcBits *) data, ic_format,
***************
*** 153,156 ****
--- 166,172 ----
_cairo_format_bpp (format),
stride);
+
+ IcFormatDestroy (ic_format);
+
if (ic_image == NULL)
return NULL;
***************
*** 158,163 ****
surface = _cairo_image_surface_create_for_ic_image (ic_image);
- IcFormatDestroy (ic_format);
-
return &surface->base;
}
--- 174,177 ----
Index: cairo_ps_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_ps_surface.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** cairo_ps_surface.c 1 Nov 2003 05:56:14 -0000 1.2
--- cairo_ps_surface.c 4 Nov 2003 02:24:45 -0000 1.3
***************
*** 46,49 ****
--- 46,53 ----
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);
More information about the cairo-commit
mailing list