From 409f90237c07d2365f6e0b527071e74415c073f3 Mon Sep 17 00:00:00 2001 From: Richard Oudkerk Date: Mon, 10 Jun 2013 15:38:54 +0100 Subject: [PATCH] Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows(). --- Misc/NEWS | 2 ++ Python/dynload_win.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index 58ae9ba469d..a204bb3c12c 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,8 @@ What's New in Python 3.3.3 release candidate 1? Core and Builtins ----------------- +- Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows(). + - Issue #18038: SyntaxError raised during compilation sources with illegal encoding now always contains an encoding name. diff --git a/Python/dynload_win.c b/Python/dynload_win.c index edb6038e3bf..ffcf0ee1d73 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;