From: Kirill Podoprigora Date: Fri, 21 Jul 2023 04:56:58 +0000 (+0300) Subject: gh-106916: Add missing error check _PyCompile_CleanDoc (#106921) X-Git-Tag: v3.13.0a1~1324 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=85ed1d24427bf3e000467aab7ee1b0322b0a9013;p=thirdparty%2FPython%2Fcpython.git gh-106916: Add missing error check _PyCompile_CleanDoc (#106921) Co-authored-by: Serhiy Storchaka --- diff --git a/Python/compile.c b/Python/compile.c index d5405b465618..9a13ab525d8a 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) {