From 3efbc0c5c850d0cb5c5af5bcabbc7293670ea355 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 20 Apr 2010 21:58:59 +0200 Subject: [PATCH] gl: Only unref a surface if it exists Note: This will likely work for NULL clones, but I prefer not dereferencing NULLs. That gives people a wrong understanding of the code (i.e. me). --- src/cairo-gl-surface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c index 1f6fd9ba9..24a5142f8 100644 --- a/src/cairo-gl-surface.c +++ b/src/cairo-gl-surface.c @@ -881,7 +881,8 @@ fail: _cairo_gl_context_release (ctx); - cairo_surface_destroy (&clone->base); + if (clone) + cairo_surface_destroy (&clone->base); return CAIRO_STATUS_SUCCESS; }