[Python-checkins] cpython: Fix ref leak in error case of unicode index
christian.heimes
python-checkins at python.org
Sat Jun 29 21:21:46 CEST 2013
http://hg.python.org/cpython/rev/ec036132cc28
changeset: 84379:ec036132cc28
user: Christian Heimes <christian at cheimes.de>
date: Sat Jun 29 21:21:37 2013 +0200
summary:
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.
files:
Objects/unicodeobject.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -11180,10 +11180,14 @@
&start, &end))
return NULL;
- if (PyUnicode_READY(self) == -1)
- return NULL;
- if (PyUnicode_READY(substring) == -1)
- return NULL;
+ if (PyUnicode_READY(self) == -1) {
+ Py_DECREF(substring);
+ return NULL;
+ }
+ if (PyUnicode_READY(substring) == -1) {
+ Py_DECREF(substring);
+ return NULL;
+ }
result = any_find_slice(1, self, substring, start, end);
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list