From 05a2171e04e92e5f7c165fb131468ca10878a116 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 10 Oct 2015 12:29:01 +0200 Subject: [PATCH] Closed memory leak with lack of memory during character set conversion. Coverity CID 12579. --- libisofs/util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libisofs/util.c b/libisofs/util.c index 16ff93c..159ca82 100644 --- a/libisofs/util.c +++ b/libisofs/util.c @@ -597,8 +597,10 @@ int str2ucs(const char *icharset, const char *input, uint16_t **output) loop_limit = inbytes + 3; ret_ = malloc((numchars+1) * sizeof(uint16_t)); - if (ret_ == NULL) + if (ret_ == NULL) { + free(wsrc_); return ISO_OUT_OF_MEM; + } outbytes = numchars * sizeof(uint16_t); ret = ret_;