1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

fix memory leak in do_convert() in src/libcdio/driver/utf8.c

This commit is contained in:
j123123 2017-07-05 03:41:13 +03:00 committed by GitHub
parent 92d046e663
commit db649b963c

View file

@ -206,16 +206,20 @@ do_convert(iconv_t cd, const char * src, int src_len,
{ {
switch(errno) switch(errno)
{ {
char * ret_tmp;
case E2BIG: case E2BIG:
output_pos = (int)(outbuf - ret); output_pos = (int)(outbuf - ret);
alloc_size += BYTES_INCREMENT; alloc_size += BYTES_INCREMENT;
outbytesleft += BYTES_INCREMENT; outbytesleft += BYTES_INCREMENT;
ret_tmp = ret;
ret = realloc(ret, alloc_size); ret = realloc(ret, alloc_size);
if (ret == NULL) if (ret == NULL)
{ {
cdio_warn("Can't realloc(%d).", alloc_size); cdio_warn("Can't realloc(%d).", alloc_size);
free(ret_tmp);
return false; return false;
} }
outbuf = ret + output_pos; outbuf = ret + output_pos;