summaryrefslogtreecommitdiff
path: root/Modules/_codecsmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_codecsmodule.c')
-rw-r--r--Modules/_codecsmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c
index 405fd7a29a..4dbceb78be 100644
--- a/Modules/_codecsmodule.c
+++ b/Modules/_codecsmodule.c
@@ -192,7 +192,8 @@ escape_encode(PyObject *self,
buf = PyString_AS_STRING (str);
len = PyString_GET_SIZE (str);
memmove(buf, buf+1, len-2);
- _PyString_Resize(&str, len-2);
+ if (_PyString_Resize(&str, len-2) < 0)
+ return NULL;
return codec_tuple(str, PyString_Size(str));
}