Fix a compile warning missed during porting (wchar_t/char) and move a
variable declaration outside of a loop. #2810 was when this first went in.
diff --git a/PC/winreg.c b/PC/winreg.c
index 8f89a00..c134a35 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -1129,6 +1129,7 @@
     int index;
     long rc;
     wchar_t *retValueBuf;
+    wchar_t *tmpBuf;
     BYTE *retDataBuf;
     DWORD retValueSize, bufValueSize;
     DWORD retDataSize, bufDataSize;
@@ -1161,7 +1162,6 @@
     }
 
     while (1) {
-        wchar_t *tmp;
         Py_BEGIN_ALLOW_THREADS
         rc = RegEnumValueW(hKey,
                   index,
@@ -1177,13 +1177,13 @@
             break;
 
         bufDataSize *= 2;
-        tmp = (char *)PyMem_Realloc(retDataBuf, bufDataSize);
-        if (tmp == NULL) {
+        tmpBuf = (wchar_t *)PyMem_Realloc(retDataBuf, bufDataSize);
+        if (tmpBuf == NULL) {
             PyErr_NoMemory();
             retVal = NULL;
             goto fail;
         }
-        retDataBuf = tmp;
+        retDataBuf = tmpBuf;
         retDataSize = bufDataSize;
         retValueSize = bufValueSize;
     }