mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-03 02:10:43 +02:00
[xlib] Fix double free of Pixmap along error path.
If the paint fails then we attempt to free the Pixmap ourselves and via the cairo_surface_destroy (as it also believes that it owns the Pixmap).
This commit is contained in:
parent
901f0b540c
commit
bf3202fcfd
1 changed files with 10 additions and 6 deletions
|
|
@ -1288,9 +1288,10 @@ _cairo_xlib_surface_create_solid_pattern_surface (void *abstrac
|
|||
status = surface->base.status;
|
||||
if (status)
|
||||
goto BAIL;
|
||||
surface->owns_pixmap = TRUE;
|
||||
|
||||
status = _cairo_surface_paint (&image->base, CAIRO_OPERATOR_SOURCE, &solid_pattern->base);
|
||||
status = _cairo_surface_paint (&image->base,
|
||||
CAIRO_OPERATOR_SOURCE,
|
||||
&solid_pattern->base);
|
||||
if (status)
|
||||
goto BAIL;
|
||||
|
||||
|
|
@ -1305,13 +1306,16 @@ _cairo_xlib_surface_create_solid_pattern_surface (void *abstrac
|
|||
BAIL:
|
||||
cairo_surface_destroy (&image->base);
|
||||
|
||||
if (status && surface) {
|
||||
XFreePixmap (other->dpy, pixmap);
|
||||
if (status) {
|
||||
if (pixmap != None)
|
||||
XFreePixmap (other->dpy, pixmap);
|
||||
cairo_surface_destroy (&surface->base);
|
||||
surface = NULL;
|
||||
|
||||
return _cairo_surface_create_in_error (status);
|
||||
}
|
||||
|
||||
return (cairo_surface_t *) surface;
|
||||
surface->owns_pixmap = TRUE;
|
||||
return &surface->base;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue