bpo-38020: Fixes crash in os.readlink() on Windows (GH-15663)

(cherry picked from commit 993ac92418839427d4068d6ae8e618b06b5d9294)

Co-authored-by: Steve Dower <steve.dower@python.org>
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index c178fac..b9e8c0d 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -7821,7 +7821,7 @@
     HANDLE reparse_point_handle;
     char target_buffer[_Py_MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
     _Py_REPARSE_DATA_BUFFER *rdb = (_Py_REPARSE_DATA_BUFFER *)target_buffer;
-    PyObject *result;
+    PyObject *result = NULL;
 
     /* First get a handle to the reparse point */
     Py_BEGIN_ALLOW_THREADS
@@ -7875,7 +7875,7 @@
             name[1] = L'\\';
         }
         result = PyUnicode_FromWideChar(name, nameLen);
-        if (path->narrow) {
+        if (result && path->narrow) {
             Py_SETREF(result, PyUnicode_EncodeFSDefault(result));
         }
     }