Closed memory leak with lack of memory during character set conversion.

Coverity CID 12567.
This commit is contained in:
Thomas Schmitt 2015-10-09 15:28:04 +02:00
parent d8fb8b26a6
commit 0433b7ea75

View File

@ -729,8 +729,10 @@ int str2utf16be(const char *icharset, const char *input, uint16_t **output)
loop_limit = inbytes + 3; loop_limit = inbytes + 3;
ret_ = malloc((2 * numchars+1) * sizeof(uint16_t)); ret_ = malloc((2 * numchars+1) * sizeof(uint16_t));
if (ret_ == NULL) if (ret_ == NULL) {
free(wsrc_);
return ISO_OUT_OF_MEM; return ISO_OUT_OF_MEM;
}
outbytes = 2 * numchars * sizeof(uint16_t); outbytes = 2 * numchars * sizeof(uint16_t);
ret = ret_; ret = ret_;