From 684c3ce6850c4168e127ea84432e7a9006296ff4 Mon Sep 17 00:00:00 2001
From: Akira TAGOH <akira@tagoh.org>
Date: Fri, 25 May 2018 13:51:10 +0900
Subject: [PATCH 1/7] Fix leaks

---
 src/fcxml.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/fcxml.c b/src/fcxml.c
index 1ee1ba1..c69ee50 100644
--- a/src/fcxml.c
+++ b/src/fcxml.c
@@ -2777,6 +2777,11 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
 	    {
 		FcConfigMessage (parse, FcSevereError, "out of memory");
 	    }
+	    else
+	    {
+		if (parse->scanOnly && vstack->u.string)
+		    FcStrFree (vstack->u.string);
+	    }
 	    break;
 	case FcVStackPattern:
 	    if (!parse->scanOnly && !FcConfigPatternsAdd (parse->config,
@@ -2786,7 +2791,11 @@ FcParseAcceptRejectFont (FcConfigParse *parse, FcElement element)
 		FcConfigMessage (parse, FcSevereError, "out of memory");
 	    }
 	    else
+	    {
+		if (parse->scanOnly && vstack->u.pattern)
+		    FcPatternDestroy (vstack->u.pattern);
 		vstack->tag = FcVStackNone;
+	    }
 	    break;
 	default:
 	    FcConfigMessage (parse, FcSevereWarning, "bad font selector");
-- 
2.17.1

