help-libidn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix unlikely memory leak in idna_to_unicode_4z4z


From: Miroslav Lichvar
Subject: [PATCH] Fix unlikely memory leak in idna_to_unicode_4z4z
Date: Tue, 10 Jul 2018 16:09:19 +0200

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

diff --git a/lib/idna.c b/lib/idna.c
index 91e34f59..fae707cc 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),
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]