summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-03-07 19:18:45 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-03-07 19:18:45 (GMT)
commit03e667d15ac2ec7409e94e151cc04b2d9dd2005d (patch)
tree759d894c78715df449732c1a1042315757bbbb99 /Modules/_testcapimodule.c
parentd4725f3f20077580ce016795b3d74b9d6e6ba52b (diff)
downloadcpython-03e667d15ac2ec7409e94e151cc04b2d9dd2005d.zip
cpython-03e667d15ac2ec7409e94e151cc04b2d9dd2005d.tar.gz
cpython-03e667d15ac2ec7409e94e151cc04b2d9dd2005d.tar.bz2
Fix memory leak introduced in 15190138d3f3.
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 7f640bc..9a14fa2 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -1423,11 +1423,15 @@ test_widechar(PyObject *self)
if (wide == NULL)
return NULL;
PyUnicode_AS_UNICODE(wide)[0] = invalid[0];
- if (_PyUnicode_Ready(wide) < 0)
+ if (_PyUnicode_Ready(wide) < 0) {
+ Py_DECREF(wide);
PyErr_Clear();
- else
+ }
+ else {
+ Py_DECREF(wide);
return raiseTestError("test_widechar",
"PyUnicode_Ready() didn't fail");
+ }
#endif
Py_RETURN_NONE;