aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c6
1 files changed, 6 insertions, 0 deletions
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) {