From c0374862fc911c88febfab36aedfceaa9e5d7d50 Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Tue, 10 Jul 2018 16:09:19 +0200
Subject: [PATCH 3/3] Fix unlikely memory leak in idna_to_unicode_4z4z

---
 lib/idna.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/idna.c b/lib/idna.c
index 91e34f5..fae707c 100644
--- a/lib/idna.c
+++ b/lib/idna.c
@@ -658,7 +658,10 @@ idna_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags)
       buflen = (size_t) (end - start);
       buf = malloc (sizeof (buf[0]) * (buflen + 1));
       if (!buf)
-	return IDNA_MALLOC_ERROR;
+	{
+	  free (out);
+	  return IDNA_MALLOC_ERROR;
+	}
 
       /* don't check return code as per specification! */
       idna_to_unicode_44i (start, (size_t) (end - start),
-- 
1.8.3.1
