[cairo-commit] cairo/src cairo_path.c, 1.17, 1.18 cairo_png_surface.c, 1.14, 1.15

Kristian Hogsberg commit at pdx.freedesktop.org
Wed Feb 16 09:34:49 PST 2005


Committed by: krh

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv22742/src

Modified Files:
	cairo_path.c cairo_png_surface.c 
Log Message:
2005-02-16  Kristian Høgsberg  <krh at redhat.com>

        Patches from Mike Owens <etc at filespanker.com>:

        * src/cairo_png_surface.c (_cairo_png_surface_copy_page): Free
        rows if we fail early in this function.

        * src/cairo_path.c (_cairo_path_init_copy): Clean up path if we
        run out of memory.



Index: cairo_path.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_path.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cairo_path.c	22 Oct 2004 01:40:50 -0000	1.17
+++ cairo_path.c	16 Feb 2005 17:34:47 -0000	1.18
@@ -100,6 +100,7 @@
     for (other_op = other->op_head; other_op; other_op = other_op->next) {
 	op = _cairo_path_op_buf_create ();
 	if (op == NULL) {
+	    _cairo_path_fini(path);
 	    return CAIRO_STATUS_NO_MEMORY;
 	}
 	*op = *other_op;
@@ -109,6 +110,7 @@
     for (other_arg = other->arg_head; other_arg; other_arg = other_arg->next) {
 	arg = _cairo_path_arg_buf_create ();
 	if (arg == NULL) {
+	    _cairo_path_fini(path);
 	    return CAIRO_STATUS_NO_MEMORY;
 	}
 	*arg = *other_arg;

Index: cairo_png_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_png_surface.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cairo_png_surface.c	31 Jan 2005 16:50:22 -0000	1.14
+++ cairo_png_surface.c	16 Feb 2005 17:34:47 -0000	1.15
@@ -331,18 +331,20 @@
 	rows[i] = surface->image->data + i * surface->image->stride;
 
     png = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-    if (png == NULL)
-	return CAIRO_STATUS_NO_MEMORY;
+    if (png == NULL) {
+	status = CAIRO_STATUS_NO_MEMORY;
+	goto BAIL1;
+    }
 
     info = png_create_info_struct (png);
     if (info == NULL) {
-	png_destroy_write_struct (&png, NULL);
-	return CAIRO_STATUS_NO_MEMORY;
+	status = CAIRO_STATUS_NO_MEMORY;
+	goto BAIL2;
     }
 
     if (setjmp (png_jmpbuf (png))) {
 	status = CAIRO_STATUS_NO_MEMORY;
-	goto BAIL;
+	goto BAIL2;
     }
     
     png_init_io (png, surface->file);
@@ -366,7 +368,7 @@
 	break;
     default:
 	status = CAIRO_STATUS_NULL_POINTER;
-	goto BAIL;
+	goto BAIL2;
     }
 
     png_set_IHDR (png, info,
@@ -399,9 +401,9 @@
 
     surface->copied = 1;
 
-BAIL:
+BAIL2:
     png_destroy_write_struct (&png, &info);
-
+BAIL1:
     free (rows);
 
     return status;




More information about the cairo-commit mailing list