From 0433b7ea75910c8d8dccbfc02727a5cc4f29a1ac Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 9 Oct 2015 15:28:04 +0200 Subject: [PATCH] Closed memory leak with lack of memory during character set conversion. Coverity CID 12567. --- libisofs/util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libisofs/util.c b/libisofs/util.c index 4701e9d..9104f95 100644 --- a/libisofs/util.c +++ b/libisofs/util.c @@ -729,8 +729,10 @@ int str2utf16be(const char *icharset, const char *input, uint16_t **output) loop_limit = inbytes + 3; ret_ = malloc((2 * numchars+1) * sizeof(uint16_t)); - if (ret_ == NULL) + if (ret_ == NULL) { + free(wsrc_); return ISO_OUT_OF_MEM; + } outbytes = 2 * numchars * sizeof(uint16_t); ret = ret_;