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

Coverity CID 12579.
This commit is contained in:
Thomas Schmitt 2015-10-10 12:29:01 +02:00
parent 188a41f041
commit 05a2171e04

View File

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