mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 21:08:10 +02:00
[scaled-font] Fix implementation-face refleak
If we found the font via the holdover cache, or if we returned due to an error, we would leak a reference count on the implementaton face.
This commit is contained in:
parent
e5d44937f3
commit
afea5eb79d
1 changed files with 8 additions and 1 deletions
|
|
@ -950,7 +950,6 @@ cairo_scaled_font_create (cairo_font_face_t *font_face,
|
|||
|
||||
_cairo_scaled_font_init_key (&key, font_face,
|
||||
font_matrix, ctm, options);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1018,6 +1017,8 @@ cairo_scaled_font_create (cairo_font_face_t *font_face,
|
|||
_cairo_scaled_font_map_unlock ();
|
||||
|
||||
cairo_scaled_font_destroy (old);
|
||||
if (font_face != original_font_face)
|
||||
cairo_font_face_destroy (font_face);
|
||||
|
||||
return scaled_font;
|
||||
}
|
||||
|
|
@ -1035,12 +1036,18 @@ cairo_scaled_font_create (cairo_font_face_t *font_face,
|
|||
/* Did we leave the backend in an error state? */
|
||||
if (unlikely (status)) {
|
||||
_cairo_scaled_font_map_unlock ();
|
||||
if (font_face != original_font_face)
|
||||
cairo_font_face_destroy (font_face);
|
||||
|
||||
status = _cairo_font_face_set_error (font_face, status);
|
||||
return _cairo_scaled_font_create_in_error (status);
|
||||
}
|
||||
/* Or did we encounter an error whilst constructing the scaled font? */
|
||||
if (unlikely (scaled_font->status)) {
|
||||
_cairo_scaled_font_map_unlock ();
|
||||
if (font_face != original_font_face)
|
||||
cairo_font_face_destroy (font_face);
|
||||
|
||||
return scaled_font;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue