summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 789bf27b..f282f99 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -5053,8 +5053,10 @@ int fsconvert_strdup(PyObject *o, char**out)
return 0;
size = PyBytes_GET_SIZE(bytes);
*out = PyMem_Malloc(size+1);
- if (!*out)
+ if (!*out) {
+ PyErr_NoMemory();
return 0;
+ }
memcpy(*out, PyBytes_AsString(bytes), size+1);
Py_DECREF(bytes);
return 1;