cairo: backport patches from upstream to use FT_Done_MM_Var instead of free

Memory allocated via FT_Get_MM_Var should be freed via FT_Done_MM_Var since
freetype 2.9.  Backport patches from upstream to address missing parts not doing
that.

PKGREVISION++
This commit is contained in:
leot 2020-07-09 14:38:55 +00:00
parent 19e3b1f28b
commit fff3b45790
3 changed files with 39 additions and 2 deletions

View file

@ -1,7 +1,9 @@
# $NetBSD: Makefile,v 1.145 2019/08/28 22:08:12 wiz Exp $
# $NetBSD: Makefile,v 1.146 2020/07/09 14:38:55 leot Exp $
.include "../../graphics/cairo/Makefile.common"
PKGREVISION= 1
TEST_TARGET= check
.include "options.mk"

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.88 2018/11/14 17:14:52 kleink Exp $
$NetBSD: distinfo,v 1.89 2020/07/09 14:38:55 leot Exp $
SHA1 (cairo-1.16.0.tar.xz) = 00e81842ae5e81bb0343108884eb5205be0eac14
RMD160 (cairo-1.16.0.tar.xz) = cfd2ef6ec55b267e04600f6b1e36bb07f2566b35
@ -8,3 +8,4 @@ SHA1 (patch-aa) = b01bc60f77a7122b0c0d0d9b25ad512bac7c190c
SHA1 (patch-ab) = 11f7e0e59bd5c51a8fdacb48dcf2f2fefdf3b768
SHA1 (patch-ac) = 1785bbef6bcab4781bf89e1b986a7eb96e5f2b64
SHA1 (patch-ad) = a1068a37113b162ccfe14d7f1bd0baa9df7e5530
SHA1 (patch-src_cairo-ft-font.c) = 97288d79380473869f1049c1d8955a2f6fa3d178

View file

@ -0,0 +1,34 @@
$NetBSD: patch-src_cairo-ft-font.c,v 1.1 2020/07/09 14:38:55 leot Exp $
Use FT_Done_MM_Var instead of free when available.
Fixes possible crashes and memory leaks.
Backport from upstream commits 90e85c24, a68c1968.
--- src/cairo-ft-font.c.orig 2020-07-09 14:26:11.503421448 +0000
+++ src/cairo-ft-font.c
@@ -459,6 +459,11 @@ _cairo_ft_unscaled_font_init (cairo_ft_u
unscaled->variations = calloc (ft_mm_var->num_axis, sizeof (FT_Fixed));
if (unscaled->variations)
FT_Get_Var_Design_Coordinates (face, ft_mm_var->num_axis, unscaled->variations);
+#if HAVE_FT_DONE_MM_VAR
+ FT_Done_MM_Var (face->glyph->library, ft_mm_var);
+#else
+ free (ft_mm_var);
+#endif
}
}
#endif
@@ -2393,7 +2398,11 @@ skip:
done:
free (coords);
free (current_coords);
+#if HAVE_FT_DONE_MM_VAR
+ FT_Done_MM_Var (face->glyph->library, ft_mm_var);
+#else
free (ft_mm_var);
+#endif
}
}