]> granicus.if.org Git - php/commitdiff
make sure this is initialized to NULL as we don't check the return
authorWez Furlong <wez@php.net>
Thu, 18 Dec 2003 11:16:16 +0000 (11:16 +0000)
committerWez Furlong <wez@php.net>
Thu, 18 Dec 2003 11:16:16 +0000 (11:16 +0000)
value of the FormatMessage function; we could end up using a stale
pointer.

win32/winutil.c

index 6fccb041d79fcfa7ff0278cfd84abb6a87c92cb0..9f1bfa42fe388da2b6024374bff56bf7bf791770 100644 (file)
@@ -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