[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:43:26 EDT 2021


https://github.com/python/cpython/commit/d57d33c2342f8ebaf9a91fe991dbfc148340e811
commit: d57d33c2342f8ebaf9a91fe991dbfc148340e811
branch: 3.9
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:43:09-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 fbeb9fb75403e..b197dfeaef805 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