Skip to content

Commit 27bb0d9

Browse files
committed
Fix readlink related memory leak
1 parent dd1d119 commit 27bb0d9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

win32/ioutil.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,12 +789,14 @@ __forceinline static ssize_t php_win32_ioutil_readlink(const char *path, char *b
789789

790790
ret_buf = php_win32_ioutil_conv_w_to_any(retw, ret, &ret_buf_len);
791791
if (!ret_buf || ret_buf_len >= buf_len || ret_buf_len >= MAXPATHLEN) {
792+
free(ret_buf);
792793
free(pathw);
793794
SET_ERRNO_FROM_WIN32_CODE(ERROR_BAD_PATHNAME);
794795
return -1;
795796
}
796797
memcpy(buf, ret_buf, ret_buf_len + 1);
797798

799+
free(ret_buf);
798800
free(pathw);
799801

800802
return ret_buf_len;

0 commit comments

Comments
 (0)