summaryrefslogtreecommitdiff
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorKen Jin <kenjin@python.org>2022-10-11 23:11:46 +0800
committerGitHub <noreply@github.com>2022-10-11 23:11:46 +0800
commit7ec2e279fea3b340f642cff888bfa45368f5ded0 (patch)
treea677cc56debb4a2f8a7d6916335a6edfa4737418 /Objects/codeobject.c
parent4067c6d7fe9b0b266367aafa8cde71e2761cb764 (diff)
downloadcpython-git-7ec2e279fea3b340f642cff888bfa45368f5ded0.tar.gz
gh-95756: Free and NULL-out code caches when needed (GH-98181)
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 7a0080c08c..8920b1db2c 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -2238,6 +2238,7 @@ _PyStaticCode_Dealloc(PyCodeObject *co)
Py_CLEAR(co->_co_cached->_co_freevars);
Py_CLEAR(co->_co_cached->_co_varnames);
PyMem_Free(co->_co_cached);
+ co->_co_cached = NULL;
}
co->co_extra = NULL;
if (co->co_weakreflist != NULL) {