Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wez committed Dec 18, 2003
1 parent e649692 commit 8959c7b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion win32/winutil.c
Expand Up @@ -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
Expand Down

0 comments on commit 8959c7b

Please sign in to comment.