summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-07-15 17:28:24 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-07-16 09:16:48 +0200
commit27bb0d91640b43224efca5a65134a9136d28fd53 (patch)
treefa07028a180834f3abfc60755c9c4b666912265e /win32
parentdd1d1191e1e4f7954cb220d1632f64abec6528d6 (diff)
downloadphp-git-27bb0d91640b43224efca5a65134a9136d28fd53.tar.gz
Fix readlink related memory leak
Diffstat (limited to 'win32')
-rw-r--r--win32/ioutil.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/win32/ioutil.h b/win32/ioutil.h
index 93dea15967..05ed3621d2 100644
--- a/win32/ioutil.h
+++ b/win32/ioutil.h
@@ -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;