Skip to content

Commit b31c787

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix readlink related memory leak
2 parents ebb94af + 27bb0d9 commit b31c787

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

win32/ioutil.h

+2
Original file line numberDiff line numberDiff line change
@@ -786,12 +786,14 @@ __forceinline static ssize_t php_win32_ioutil_readlink(const char *path, char *b
786786

787787
ret_buf = php_win32_ioutil_conv_w_to_any(retw, ret, &ret_buf_len);
788788
if (!ret_buf || ret_buf_len >= buf_len || ret_buf_len >= MAXPATHLEN) {
789+
free(ret_buf);
789790
free(pathw);
790791
SET_ERRNO_FROM_WIN32_CODE(ERROR_BAD_PATHNAME);
791792
return -1;
792793
}
793794
memcpy(buf, ret_buf, ret_buf_len + 1);
794795

796+
free(ret_buf);
795797
free(pathw);
796798

797799
return ret_buf_len;

0 commit comments

Comments
 (0)