BAIL1:
_cairo_png_surface_copy_page (void *abstract_surface){    int i;    cairo_status_t status = CAIRO_STATUS_SUCCESS;    cairo_png_surface_t *surface = abstract_surface;    png_struct *png;    png_info *info;    png_byte **rows;    png_color_16 white;    int png_color_type;    int depth;    rows = malloc (surface->image->height * sizeof(png_byte*));    if (rows == NULL)	return CAIRO_STATUS_NO_MEMORY;    for (i = 0; i < surface->image->height; i++)	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;    info = png_create_info_struct (png);    if (info == NULL) {	png_destroy_write_struct (&png, NULL);	return CAIRO_STATUS_NO_MEMORY;    }    if (setjmp (png_jmpbuf (png))) {	status = CAIRO_STATUS_NO_MEMORY;	goto BAIL;    }        png_init_io (png, surface->file);    switch (surface->format) {    case CAIRO_FORMAT_ARGB32:	depth = 8;	png_color_type = PNG_COLOR_TYPE_RGB_ALPHA;	break;    case CAIRO_FORMAT_RGB24:	depth = 8;	png_color_type = PNG_COLOR_TYPE_RGB;	break;    case CAIRO_FORMAT_A8:	depth = 8;	png_color_type = PNG_COLOR_TYPE_GRAY;	break;    case CAIRO_FORMAT_A1:	depth = 1;	png_color_type = PNG_COLOR_TYPE_GRAY;	break;    default:	status = CAIRO_STATUS_NULL_POINTER;	goto BAIL;    }    png_set_IHDR (png, info,		  surface->image->width,		  surface->image->height, depth,		  png_color_type,		  PNG_INTERLACE_NONE,		  PNG_COMPRESSION_TYPE_DEFAULT,		  PNG_FILTER_TYPE_DEFAULT);    white.red = 0xff;    white.blue = 0xff;    white.green = 0xff;    png_set_bKGD (png, info, &white);/* XXX: Setting the time is interfereing with the image comparison    png_convert_from_time_t (&png_time, time (NULL));    png_set_tIME (png, info, &png_time);*/    png_set_write_user_transform_fn (png, unpremultiply_data);    if (surface->format == CAIRO_FORMAT_ARGB32 || surface->format == CAIRO_FORMAT_RGB24)	png_set_bgr (png);    if (surface->format == CAIRO_FORMAT_RGB24)	png_set_filler (png, 0, PNG_FILLER_AFTER);    png_write_info (png, info);    png_write_image (png, rows);    png_write_end (png, info);    surface->copied = 1;BAIL:    png_destroy_write_struct (&png, &info);    free (rows);    return status;}