From: Anatol Belski Date: Mon, 29 Aug 2016 15:25:46 +0000 (+0200) Subject: add error check and fix leak X-Git-Tag: php-7.1.0RC1~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=201f90a8ccd5d4578f3200781341dc3b781c36f2;p=php add error check and fix leak --- diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index e443ec64a6..95803c9bbd 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -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; }