[Python-checkins] Fix a leak in _PyImport_LoadDynamicModuleWithSpec() after failing PySys_Audit() (GH-28862)

serhiy-storchaka webhook-mailer at python.org
Mon Oct 11 04:57:32 EDT 2021


https://github.com/python/cpython/commit/9883ca498d654a4792d530bd8d6d64fef4dc971c
commit: 9883ca498d654a4792d530bd8d6d64fef4dc971c
branch: main
author: Serhiy Storchaka <storchaka at gmail.com>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2021-10-11T11:57:27+03:00
summary:

Fix a leak in _PyImport_LoadDynamicModuleWithSpec() after failing PySys_Audit() (GH-28862)

files:
M Python/importdl.c

diff --git a/Python/importdl.c b/Python/importdl.c
index 1847eba74aef4..27ffc64284098 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -121,7 +121,7 @@ _PyImport_LoadDynamicModuleWithSpec(PyObject *spec, FILE *fp)
 
     if (PySys_Audit("import", "OOOOO", name_unicode, path,
                     Py_None, Py_None, Py_None) < 0) {
-        return NULL;
+        goto error;
     }
 
 #ifdef MS_WINDOWS



More information about the Python-checkins mailing list