[cairo-commit] src/cairo-xlib-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Tue May 1 04:37:34 PDT 2007


 src/cairo-xlib-surface.c |    2 ++
 1 files changed, 2 insertions(+)

New commits:
diff-tree 7f7f4d4f35cd640733b990fcff924a090b43d360 (from 3e3bd4df7e810a9acd14cd6f3717633f71691b9e)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue May 1 12:37:38 2007 +0100

    [cairo-xlib-surface.c] Free the Pixmap on surface construction failure.
    
    If we create the Pixmap whilst constructing a similar xlib surface, then
    it our responsibility to free the Pixmap should we fail to allocate the
    surface.

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index ea34321..de019e7 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -174,6 +174,7 @@ _cairo_xlib_surface_create_similar_with_
 						       xrender_format,
 						       width, height);
     if (surface->base.status != CAIRO_STATUS_SUCCESS) {
+	XFreePixmap (dpy, pix);
 	_cairo_error (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_surface_t*) &_cairo_surface_nil;
     }
@@ -251,6 +252,7 @@ _cairo_xlib_surface_create_similar (void
 						       xrender_format,
 						       width, height);
     if (surface->base.status != CAIRO_STATUS_SUCCESS) {
+	XFreePixmap (src->dpy, pix);
 	_cairo_error (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_surface_t*) &_cairo_surface_nil;
     }


More information about the cairo-commit mailing list