From 409f90237c07d2365f6e0b527071e74415c073f3 Mon Sep 17 00:00:00 2001 From: Richard Oudkerk Date: Mon, 10 Jun 2013 15:38:54 +0100 Subject: Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows(). --- Python/dynload_win.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Python/dynload_win.c') diff --git a/Python/dynload_win.c b/Python/dynload_win.c index edb6038e3b..ffcf0ee1d7 100644 --- a/Python/dynload_win.c +++ b/Python/dynload_win.c @@ -262,8 +262,9 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname, theLength)); } if (message != NULL) { - PyErr_SetImportError(message, PyUnicode_FromString(shortname), - pathname); + PyObject *shortname_obj = PyUnicode_FromString(shortname); + PyErr_SetImportError(message, shortname_obj, pathname); + Py_XDECREF(shortname_obj); Py_DECREF(message); } return NULL; -- cgit v1.2.1