]> granicus.if.org Git - php/commitdiff
- init err
authorPierre Joye <pajoye@php.net>
Thu, 20 Jan 2011 06:44:16 +0000 (06:44 +0000)
committerPierre Joye <pajoye@php.net>
Thu, 20 Jan 2011 06:44:16 +0000 (06:44 +0000)
ext/com_dotnet/com_olechar.c

index 409fd810ddbb0c325b7f5daafb63f4b497d709a3..657d45b55d25991a6f2277ceff283cfc03918f53 100644 (file)
@@ -79,7 +79,6 @@ PHPAPI char *php_com_olestring_to_string(OLECHAR *olestring, uint *string_len, i
                length = WideCharToMultiByte(codepage, 0, olestring, -1, string, length, NULL, NULL);
                ok = length > 0;
        } else {
-               err = GetLastError();
                string = (char*)emalloc(sizeof(char));
                *string = '\0';
                ok = FALSE;
@@ -87,7 +86,9 @@ PHPAPI char *php_com_olestring_to_string(OLECHAR *olestring, uint *string_len, i
        }
 
        if (!ok) {
-               char *msg = php_win32_error_to_msg(err);
+               char *msg;
+               err = GetLastError();
+               msg = php_win32_error_to_msg(err);
 
                php_error_docref(NULL TSRMLS_CC, E_WARNING,
                        "Could not convert string from unicode: `%s'", msg);