From c84a43f27765066b78c9c383489fb68e10d67d96 Mon Sep 17 00:00:00 2001
From: John Cupitt <jcupitt@gmail.com>
Date: Sat, 21 Dec 2019 12:56:09 +0000
Subject: [PATCH] fix memleak in vips_text()

We were not unreffing PangoLayout. Thank you uint128!

See https://github.com/libvips/libvips/issues/1508
---
 libvips/create/text.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libvips/create/text.c b/libvips/create/text.c
index a0733e31..86d04c32 100644
--- a/libvips/create/text.c
+++ b/libvips/create/text.c
@@ -182,6 +182,7 @@ vips_text_get_extents( VipsText *text, VipsRect *extents )
 	pango_ft2_font_map_set_resolution( 
 		PANGO_FT2_FONT_MAP( vips_text_fontmap ), text->dpi, text->dpi );
 
+	VIPS_UNREF( text->layout );
 	if( !(text->layout = text_layout_new( text->context, 
 		text->text, text->font, 
 		text->width, text->spacing, text->align, text->justify )) )