msvcrt: read_utf8: free readbuf on return (Coverity).
This commit is contained in:
parent
dfa88a21c9
commit
a8b076d67f
|
@ -2226,13 +2226,16 @@ static int read_utf8(int fd, MSVCRT_wchar_t *buf, unsigned int count)
|
||||||
num_read = 0;
|
num_read = 0;
|
||||||
}else if(GetLastError() == ERROR_BROKEN_PIPE) {
|
}else if(GetLastError() == ERROR_BROKEN_PIPE) {
|
||||||
fdinfo->wxflag |= WX_ATEOF;
|
fdinfo->wxflag |= WX_ATEOF;
|
||||||
|
if (readbuf != min_buf) MSVCRT_free(readbuf);
|
||||||
return 0;
|
return 0;
|
||||||
}else {
|
}else {
|
||||||
msvcrt_set_errno(GetLastError());
|
msvcrt_set_errno(GetLastError());
|
||||||
|
if (readbuf != min_buf) MSVCRT_free(readbuf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}else if(!pos && !num_read) {
|
}else if(!pos && !num_read) {
|
||||||
fdinfo->wxflag |= WX_ATEOF;
|
fdinfo->wxflag |= WX_ATEOF;
|
||||||
|
if (readbuf != min_buf) MSVCRT_free(readbuf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2291,9 +2294,11 @@ static int read_utf8(int fd, MSVCRT_wchar_t *buf, unsigned int count)
|
||||||
|
|
||||||
if(!(num_read = MultiByteToWideChar(CP_UTF8, 0, readbuf, pos, buf, count))) {
|
if(!(num_read = MultiByteToWideChar(CP_UTF8, 0, readbuf, pos, buf, count))) {
|
||||||
msvcrt_set_errno(GetLastError());
|
msvcrt_set_errno(GetLastError());
|
||||||
|
if (readbuf != min_buf) MSVCRT_free(readbuf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (readbuf != min_buf) MSVCRT_free(readbuf);
|
||||||
return num_read*2;
|
return num_read*2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue