--- org/cairo-surface-snapshot.c 2015-05-27 13:38:17.579455181 +0530 +++ change/cairo-surface-snapshot.c 2015-05-27 13:39:47.075055772 +0530 @@ -108,6 +108,7 @@ if (unlikely (status)) { cairo_surface_destroy (extra->target); free (extra); + extra=NULL; } *extra_out = extra;