From 27bb0d91640b43224efca5a65134a9136d28fd53 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Wed, 15 Jul 2020 17:28:24 +0200 Subject: Fix readlink related memory leak --- win32/ioutil.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'win32') 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; -- cgit v1.2.1