diff options
author | Wez Furlong <wez@php.net> | 2003-12-18 11:16:16 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2003-12-18 11:16:16 +0000 |
commit | 8959c7bc0d4209383000b748d1df256707c35b81 (patch) | |
tree | 10ea01f87c635873ac3d8e927af787dfc41dc5ef /win32 | |
parent | e649692565aa7d45f6915bab5273530c33e2f334 (diff) | |
download | php-git-8959c7bc0d4209383000b748d1df256707c35b81.tar.gz |
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.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/winutil.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 |