[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cairo
Subject:    Re: [cairo] cairo-user-fonts in hb-view
From:       Matthias Clasen <matthias.clasen () gmail ! com>
Date:       2022-02-11 2:21:50
Message-ID: CAFwd_vDwT9W1xTFoFAUevfXK1Hxcx3uf1v8S78N92RN-gahNYQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Tue, Feb 8, 2022 at 7:09 PM Behdad Esfahbod <behdad@behdad.org> wrote:


> There's also leaks that valgrind is showing me...
>

Here's some leak fixes for the color glyph support in user fonts.
These are just from the reading the code, so testing appreciated:

[Attachment #5 (text/html)]

<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Tue, Feb 8, 2022 at 7:09 PM Behdad Esfahbod &lt;<a \
href="mailto:behdad@behdad.org">behdad@behdad.org</a>&gt; wrote:<br></div><div>  \
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">There&#39;s also leaks that \
valgrind is showing me... <br></div></blockquote><div><br></div><div>Here&#39;s some \
leak fixes for the color glyph support in user fonts.</div><div>These are just from \
the reading the code, so testing appreciated: <br></div></div></div>


["0001-user-font-Plug-some-memory-leaks.patch" (text/x-patch)]

From 537445c4f07d02e84e6838f6f4c218487c7e113d Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Thu, 10 Feb 2022 21:17:58 -0500
Subject: [PATCH] user-font: Plug some memory leaks

We were leaking a cairo_t and a surface here, in
some code paths.
---
 src/cairo-user-font.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c
index d6427f060..2d3c691f0 100644
--- a/src/cairo-user-font.c
+++ b/src/cairo-user-font.c
@@ -187,10 +187,13 @@ _cairo_user_scaled_glyph_init (void			 *abstract_font,
 		    status = cairo_status (cr);
 		    scaled_glyph->recording_is_color = TRUE;
 		}
+		cairo_destroy (cr);
 	    }
 
 	    if (status == (cairo_int_status_t)CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED &&
 		face->scaled_font_methods.render_glyph) {
+                if (recording_surface)
+                    cairo_surface_destroy (recording_surface);
 		recording_surface = _cairo_user_scaled_font_create_recording_surface (scaled_font, FALSE);
 
 		cr = _cairo_user_scaled_font_create_recording_context (scaled_font, recording_surface, FALSE);
-- 
2.33.1



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic