From 85ed1d24427bf3e000467aab7ee1b0322b0a9013 Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Fri, 21 Jul 2023 07:56:58 +0300 Subject: [PATCH] gh-106916: Add missing error check _PyCompile_CleanDoc (#106921) Co-authored-by: Serhiy Storchaka --- Python/compile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Python/compile.c b/Python/compile.c index d5405b46561..9a13ab525d8 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -8053,6 +8053,12 @@ _PyCompile_CleanDoc(PyObject *doc) } char *buff = PyMem_Malloc(doc_size); + if (buff == NULL){ + Py_DECREF(doc); + PyErr_NoMemory(); + return NULL; + } + char *w = buff; while (p < pend) {