]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106916: Add missing error check _PyCompile_CleanDoc (#106921)
authorKirill Podoprigora <kirill.bast9@mail.ru>
Fri, 21 Jul 2023 04:56:58 +0000 (07:56 +0300)
committerGitHub <noreply@github.com>
Fri, 21 Jul 2023 04:56:58 +0000 (13:56 +0900)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Python/compile.c

index d5405b46561820406cae310849e168e9a2be26ee..9a13ab525d8a47144cf20f240e3b1794944eb186 100644 (file)
@@ -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) {