Merge branch 'PHP-7.1'

* PHP-7.1:
  add error check and fix leak
  fix leak
This commit is contained in:
Anatol Belski 2016-08-29 17:26:41 +02:00
commit 646d3f66a3
2 changed files with 6 additions and 0 deletions

View File

@ -753,9 +753,14 @@ PHP_FUNCTION(proc_open)
len = (sizeof(COMSPEC_NT) + sizeof(" /c ") + tmp_len + 1);
cmdw2 = (wchar_t *)malloc(len * sizeof(wchar_t));
if (!cmdw2) {
php_error_docref(NULL, E_WARNING, "Command conversion failed");
goto exit_fail;
}
ret = _snwprintf(cmdw2, len, L"%hs /c %s", COMSPEC_NT, cmdw);
if (-1 == ret) {
free(cmdw2);
php_error_docref(NULL, E_WARNING, "Command conversion failed");
goto exit_fail;
}

View File

@ -425,6 +425,7 @@ PW32IO wchar_t *php_win32_ioutil_getcwd_w(const wchar_t *buf, int len)
if (!GetCurrentDirectoryW(len, buf)) {
err = GetLastError();
SET_ERRNO_FROM_WIN32_CODE(err);
free(tmp_buf);
return NULL;
}