mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix readlink related memory leak
This commit is contained in:
@@ -789,12 +789,14 @@ __forceinline static ssize_t php_win32_ioutil_readlink(const char *path, char *b
|
||||
|
||||
ret_buf = php_win32_ioutil_conv_w_to_any(retw, ret, &ret_buf_len);
|
||||
if (!ret_buf || ret_buf_len >= buf_len || ret_buf_len >= MAXPATHLEN) {
|
||||
free(ret_buf);
|
||||
free(pathw);
|
||||
SET_ERRNO_FROM_WIN32_CODE(ERROR_BAD_PATHNAME);
|
||||
return -1;
|
||||
}
|
||||
memcpy(buf, ret_buf, ret_buf_len + 1);
|
||||
|
||||
free(ret_buf);
|
||||
free(pathw);
|
||||
|
||||
return ret_buf_len;
|
||||
|
||||
Reference in New Issue
Block a user