summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-06-29 19:21:37 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-06-29 19:21:37 (GMT)
commitd47a0456b1120fe15bf2996a7acfd0e3340c6c9a (patch)
treebafc6ec07f5f59aa0178ed2f62af9ba5c445efb1 /Objects
parentea71a525c34784d188252947f497ed251f9d4d5c (diff)
downloadcpython-d47a0456b1120fe15bf2996a7acfd0e3340c6c9a.zip
cpython-d47a0456b1120fe15bf2996a7acfd0e3340c6c9a.tar.gz
cpython-d47a0456b1120fe15bf2996a7acfd0e3340c6c9a.tar.bz2
Fix ref leak in error case of unicode index
CID 983319 (#1 of 2): Resource leak (RESOURCE_LEAK) leaked_storage: Variable substring going out of scope leaks the storage it points to.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index fe0337f..501921d 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -11180,10 +11180,14 @@ unicode_index(PyObject *self, PyObject *args)
&start, &end))
return NULL;
- if (PyUnicode_READY(self) == -1)
+ if (PyUnicode_READY(self) == -1) {
+ Py_DECREF(substring);
return NULL;
- if (PyUnicode_READY(substring) == -1)
+ }
+ if (PyUnicode_READY(substring) == -1) {
+ Py_DECREF(substring);
return NULL;
+ }
result = any_find_slice(1, self, substring, start, end);