From: Wez Furlong Date: Thu, 18 Dec 2003 11:16:16 +0000 (+0000) Subject: make sure this is initialized to NULL as we don't check the return X-Git-Tag: php-5.0.0b3RC2~67 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8959c7bc0d4209383000b748d1df256707c35b81;p=php make sure this is initialized to NULL as we don't check the return value of the FormatMessage function; we could end up using a stale pointer. --- diff --git a/win32/winutil.c b/win32/winutil.c index 6fccb041d7..9f1bfa42fe 100644 --- a/win32/winutil.c +++ b/win32/winutil.c @@ -26,9 +26,11 @@ PHPAPI char *php_win_err(int error) /* leak for now */ if (buf) { free(buf); - buf = NULL; } #endif + + buf = NULL; + FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buf, 0, NULL