mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-27 04:40:11 +01:00
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:
parent
46eab95698
commit
274c20c27a
1 changed files with 9 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue