diff options
author | Anatol Belski <ab@php.net> | 2016-08-06 22:33:29 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2016-08-08 10:33:07 +0200 |
commit | 33a7ad2365d79a71429c81978190b488cbbc007d (patch) | |
tree | 2ca03dca353a9d65397d246e9e82970673338455 /win32/codepage.c | |
parent | f706897f330038d17570f5d0e6091e06d90179a6 (diff) | |
download | php-git-33a7ad2365d79a71429c81978190b488cbbc007d.tar.gz |
check malloc result
Diffstat (limited to 'win32/codepage.c')
-rw-r--r-- | win32/codepage.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/win32/codepage.c b/win32/codepage.c index d6f42d3784..d9291305bc 100644 --- a/win32/codepage.c +++ b/win32/codepage.c @@ -369,6 +369,10 @@ PW32CP wchar_t *php_win32_cp_env_any_to_w(const char* env) } while (NULL != (cur = strchr(prev, '\0')) && cur++ && *cur && bin_len + (cur - prev) < 32760); envw = (wchar_t *) malloc((bin_len + 3) * sizeof(wchar_t)); + if (!envw) { + SET_ERRNO_FROM_WIN32_CODE(ERROR_OUTOFMEMORY); + return NULL; + } memmove(envw, ew, bin_len * sizeof(wchar_t)); envw[bin_len] = L'\0'; envw[bin_len + 1] = L'\0'; |