diff options
author | krakjoe <krakjoe@php.net> | 2017-11-22 04:49:43 +0000 |
---|---|---|
committer | krakjoe <krakjoe@php.net> | 2017-11-22 04:49:43 +0000 |
commit | ae810d785c2138471b460d7eca6bb2fc7ca33545 (patch) | |
tree | 4f5a36d84e743de05d19019f4a2f65c5a9de5e75 /main | |
parent | 1362c849e8d4e1866d3a60b0d5e105e70db77437 (diff) | |
parent | fee6c812c400d5c68b8851cec2a95686dc06129b (diff) | |
download | php-git-ae810d785c2138471b460d7eca6bb2fc7ca33545.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Check for binary_location allocation failure
Diffstat (limited to 'main')
-rw-r--r-- | main/main.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/main/main.c b/main/main.c index 26105f62b8..250dcb8408 100644 --- a/main/main.c +++ b/main/main.c @@ -271,17 +271,17 @@ static void php_disable_classes(void) */ static void php_binary_init(void) { - char *binary_location; + char *binary_location = NULL; #ifdef PHP_WIN32 binary_location = (char *)malloc(MAXPATHLEN); - if (GetModuleFileName(0, binary_location, MAXPATHLEN) == 0) { + if (binary_location && GetModuleFileName(0, binary_location, MAXPATHLEN) == 0) { free(binary_location); PG(php_binary) = NULL; } #else if (sapi_module.executable_location) { binary_location = (char *)malloc(MAXPATHLEN); - if (!strchr(sapi_module.executable_location, '/')) { + if (binary_location && !strchr(sapi_module.executable_location, '/')) { char *envpath, *path; int found = 0; @@ -311,8 +311,6 @@ static void php_binary_init(void) free(binary_location); binary_location = NULL; } - } else { - binary_location = NULL; } #endif PG(php_binary) = binary_location; |