mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 15:48:00 +02:00
snapshot: Don't use extra after it's been freed (CID #220086)
Note this changes the semantics of the value of extra_out such that it is set to NULL instead of left undefined in case an error is returned. Coverity ID: 220086 Signed-off-by: Bryce Harrington <bryce@bryceharrington.org> Reviewed-By: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
37655af38d
commit
1c3ecfac13
1 changed files with 4 additions and 1 deletions
|
|
@ -100,14 +100,17 @@ _cairo_surface_snapshot_acquire_source_image (void *abstract_
|
|||
cairo_status_t status;
|
||||
|
||||
extra = _cairo_malloc (sizeof (*extra));
|
||||
if (unlikely (extra == NULL))
|
||||
if (unlikely (extra == NULL)) {
|
||||
*extra_out = NULL;
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
}
|
||||
|
||||
extra->target = _cairo_surface_snapshot_get_target (&surface->base);
|
||||
status = _cairo_surface_acquire_source_image (extra->target, image_out, &extra->extra);
|
||||
if (unlikely (status)) {
|
||||
cairo_surface_destroy (extra->target);
|
||||
free (extra);
|
||||
extra = NULL;
|
||||
}
|
||||
|
||||
*extra_out = extra;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue