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

miss-islington webhook-mailer at python.org
Mon Oct 11 05:22:34 EDT 2021


https://github.com/python/cpython/commit/3a58d6062060f9fcc1f4f9c43358769305bafef8
commit: 3a58d6062060f9fcc1f4f9c43358769305bafef8
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-10-11T02:22:29-07:00
summary:

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

(cherry picked from commit 9883ca498d654a4792d530bd8d6d64fef4dc971c)

Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>

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