summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-10-05 12:55:13 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2007-10-05 18:34:32 +0100
commit31b52779bad4122d101cdffdb03153baf6cd011e (patch)
tree0bc45829d62beca3561af206296c1c31ccc85cc4 /boilerplate
parentb210bea6c1867ef9d5c344747d17ca216f6071bd (diff)
[cairo-boilerplate-xlib] Cleanup fallback after creation failure.
Cleanup the local resource if we fail to create the X window and surface for the xlib fallback test target.
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate-xlib.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c
index 781f8f9e2..28d1a2e24 100644
--- a/boilerplate/cairo-boilerplate-xlib.c
+++ b/boilerplate/cairo-boilerplate-xlib.c
@@ -254,6 +254,7 @@ _cairo_boilerplate_xlib_fallback_create_surface (const char *name,
xtc->dpy = dpy = XOpenDisplay (NULL);
if (xtc->dpy == NULL) {
CAIRO_BOILERPLATE_LOG ("Failed to open display: %s\n", XDisplayName(0));
+ free (xtc);
return NULL;
}
@@ -266,6 +267,8 @@ _cairo_boilerplate_xlib_fallback_create_surface (const char *name,
if (! _cairo_boilerplate_xlib_check_screen_size (dpy, screen,
width, height)) {
CAIRO_BOILERPLATE_LOG ("Surface is larger than the Screen.\n");
+ XCloseDisplay (dpy);
+ free (xtc);
return NULL;
}
@@ -283,8 +286,10 @@ _cairo_boilerplate_xlib_fallback_create_surface (const char *name,
surface = cairo_xlib_surface_create (dpy, xtc->drawable,
DefaultVisual (dpy, screen),
width, height);
-
- cairo_boilerplate_xlib_surface_disable_render (surface);
+ if (cairo_surface_status (surface))
+ _cairo_boilerplate_xlib_cleanup (xtc);
+ else
+ cairo_boilerplate_xlib_surface_disable_render (surface);
return surface;
}