summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-09-28 21:39:17 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-09-28 21:39:17 +0200
commitfe0746fa379e590e4431680f351a4abeec232219 (patch)
tree57fd52e934b787176bf0f7790ebb9c38700c24dc /Python/compile.c
parente6894c0f9e9ec2790fb31fb30b6c75e7f917c102 (diff)
downloadcpython-fe0746fa379e590e4431680f351a4abeec232219.tar.gz
Check for PyUnicode_CopyCharacters() failure
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 5f03792b3e..906772289d 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -245,8 +245,14 @@ _Py_Mangle(PyObject *privateobj, PyObject *ident)
return 0;
/* ident = "_" + priv[ipriv:] + ident # i.e. 1+plen+nlen bytes */
PyUnicode_WRITE(PyUnicode_KIND(result), PyUnicode_DATA(result), 0, '_');
- PyUnicode_CopyCharacters(result, 1, privateobj, ipriv, plen);
- PyUnicode_CopyCharacters(result, plen+1, ident, 0, nlen);
+ if (PyUnicode_CopyCharacters(result, 1, privateobj, ipriv, plen) < 0) {
+ Py_DECREF(result);
+ return NULL;
+ }
+ if (PyUnicode_CopyCharacters(result, plen+1, ident, 0, nlen) < 0) {
+ Py_DECREF(result);
+ return NULL;
+ }
return result;
}