From b1dc4dc97ec9e7ab89e31da9fd80b797ef5ae256 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Thu, 30 Jul 2009 07:25:36 +0200 Subject: [PATCH] (_hx509_Name_to_string): free memory on failure (that should not happen) [CID 176] --- lib/hx509/name.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/hx509/name.c b/lib/hx509/name.c index b8f48d523..23736edde 100644 --- a/lib/hx509/name.c +++ b/lib/hx509/name.c @@ -235,8 +235,10 @@ _hx509_Name_to_string(const Name *n, char **str) if (ss == NULL) _hx509_abort("allocation failure"); /* XXX */ ret = wind_ucs2utf8(bmp, bmplen, ss, NULL); - if (ret) + if (ret) { + free(ss); return ret; + } ss[k] = '\0'; break; } @@ -260,8 +262,10 @@ _hx509_Name_to_string(const Name *n, char **str) if (ss == NULL) _hx509_abort("allocation failure"); /* XXX */ ret = wind_ucs4utf8(uni, unilen, ss, NULL); - if (ret) + if (ret) { + free(ss); return ret; + } ss[k] = '\0'; break; }