summaryrefslogtreecommitdiffstats
path: root/Python/codecs.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/codecs.c')
-rw-r--r--Python/codecs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index 69498c4..7d1145f 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -696,8 +696,10 @@ PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc)
ressize += 1+1+2;
}
res = PyUnicode_FromUnicode(NULL, ressize);
- if (res==NULL)
+ if (res == NULL) {
+ Py_DECREF(object);
return NULL;
+ }
for (p = startp+start, outp = PyUnicode_AS_UNICODE(res);
p < startp+end; ++p) {
Py_UNICODE c = *p;