diff options
Diffstat (limited to 'c/misc_win32.h')
-rw-r--r-- | c/misc_win32.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/c/misc_win32.h b/c/misc_win32.h index 07b76c1..156cf5d 100644 --- a/c/misc_win32.h +++ b/c/misc_win32.h @@ -124,8 +124,10 @@ static PyObject *b_getwinerror(PyObject *self, PyObject *args, PyObject *kwds) s_buf[--len] = L'\0'; message = PyUnicode_FromWideChar(s_buf, len); } - if (message != NULL) + if (message != NULL) { v = Py_BuildValue("(iO)", err, message); + Py_DECREF(message); + } else v = NULL; LocalFree(s_buf); @@ -168,7 +170,6 @@ static PyObject *b_getwinerror(PyObject *self, PyObject *args, PyObject *kwds) /* Only seen this in out of mem situations */ sprintf(s_small_buf, "Windows Error 0x%X", err); s = s_small_buf; - s_buf = NULL; } else { s = s_buf; /* remove trailing cr/lf and dots */ |