com php-src: Fix readlink related memory leak: win32/ioutil.h
| From: | Christoph Michael Becker | Date: | Thu, 16 Jul 2020 07:16:48 +0000 |
| Subject: | com php-src: Fix readlink related memory leak: win32/ioutil.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-112185@lists.php.net to get a copy of this message | ||
Commit: 27bb0d91640b43224efca5a65134a9136d28fd53
Author: Christoph M. Becker <cmbecker69@gmx.de> Wed, 15 Jul 2020 17:28:24 +0200
Parents: dd1d1191e1e4f7954cb220d1632f64abec6528d6
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=27bb0d91640b43224efca5a65134a9136d28fd53
Log:
Fix readlink related memory leak
Changed paths:
M win32/ioutil.h
Diff:
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;