Skip to content

Commit 409f902

Browse files
committed
Issue python#18180: Fix ref leak in _PyImport_GetDynLoadWindows().
1 parent a822d36 commit 409f902

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ What's New in Python 3.3.3 release candidate 1?
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows().
16+
1517
- Issue #18038: SyntaxError raised during compilation sources with illegal
1618
encoding now always contains an encoding name.
1719

Python/dynload_win.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,9 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname,
262262
theLength));
263263
}
264264
if (message != NULL) {
265-
PyErr_SetImportError(message, PyUnicode_FromString(shortname),
266-
pathname);
265+
PyObject *shortname_obj = PyUnicode_FromString(shortname);
266+
PyErr_SetImportError(message, shortname_obj, pathname);
267+
Py_XDECREF(shortname_obj);
267268
Py_DECREF(message);
268269
}
269270
return NULL;

0 commit comments

Comments
 (0)