cairo-boilerplate - handle failure to set user data

After failing to set the user data on a surface, clean up and return NULL.
This commit is contained in:
Chris Wilson 2007-04-08 21:14:09 +01:00
parent 46eab95698
commit 274c20c27a

View file

@ -1062,7 +1062,15 @@ create_ps_surface (const char *name,
ptc->target = NULL;
}
cairo_surface_set_user_data (surface, &ps_closure_key, ptc, NULL);
if (cairo_surface_set_user_data (surface,
&ps_closure_key,
ptc,
NULL) != CAIRO_STATUS_SUCCESS) {
cairo_surface_destroy (surface);
free (ptc->filename);
free (ptc);
return NULL;
}
return surface;
}