Fix a reference leak in _io._WindowsConsoleIO: PyUnicode_FSDecoder()
always initialize decodedname when it succeed and it doesn't clear
input decodedname object.
DWORD length;
wchar_t name_buf[MAX_PATH], *pname_buf = name_buf;
-
+
length = GetFullPathNameW(decoded_wstr, MAX_PATH, pname_buf, NULL);
if (length > MAX_PATH) {
pname_buf = PyMem_New(wchar_t, length);
self->fd = fd;
if (fd < 0) {
- PyObject *decodedname = Py_None;
- Py_INCREF(decodedname);
+ PyObject *decodedname;
int d = PyUnicode_FSDecoder(nameobj, (void*)&decodedname);
if (!d)