[cairo-commit] 2 commits - src/cairo-gstate.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 19 16:10:05 UTC 2023


 src/cairo-gstate.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 7b1de369ddace078c2ffc8b0bde211c5c3eeb810
Merge: 2c557d7ce a32ddef9d
Author: Uli Schlachter <psychon at znc.in>
Date:   Thu Jan 19 16:10:03 2023 +0000

    Merge branch 'gstate-font-options' into 'master'
    
    [gstate] Fix cairo_font_options_t memory management
    
    See merge request cairo/cairo!414

commit a32ddef9d9261e83493932464b43f5cebb9f46ef
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jan 18 23:18:13 2023 -0700

    [gstate] Fix cairo_font_options_t memory management
    
    cairo_font_options_t has grown to have malloc'ed memory,
    so the previous code was leaking, and double-freeing.

diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index a8c67e718..0d52491c9 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -1753,6 +1753,7 @@ _cairo_gstate_set_font_options (cairo_gstate_t             *gstate,
 
     _cairo_gstate_unset_scaled_font (gstate);
 
+    _cairo_font_options_fini (&gstate->font_options);
     _cairo_font_options_init_copy (&gstate->font_options, options);
 }
 
@@ -1760,7 +1761,8 @@ void
 _cairo_gstate_get_font_options (cairo_gstate_t       *gstate,
 				cairo_font_options_t *options)
 {
-    *options = gstate->font_options;
+    _cairo_font_options_fini (options);
+    _cairo_font_options_init_copy (options, &gstate->font_options);
 }
 
 cairo_status_t


More information about the cairo-commit mailing list