From 8959c7bc0d4209383000b748d1df256707c35b81 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 18 Dec 2003 11:16:16 +0000 Subject: [PATCH] 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. --- win32/winutil.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.40.0