summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-06-29 18:41:06 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-06-29 18:41:06 (GMT)
commit305e49e17edd6870b52af547a6c6cbf613864d05 (patch)
treef850f1fd9248825ac221707a63271809c4ede53f /Objects
parentb7bb6f571b0d760a503e18bb81ff2c6582159e2a (diff)
downloadcpython-305e49e17edd6870b52af547a6c6cbf613864d05.zip
cpython-305e49e17edd6870b52af547a6c6cbf613864d05.tar.gz
cpython-305e49e17edd6870b52af547a6c6cbf613864d05.tar.bz2
Fix memory leak in endswith
CID 1040368 (#1 of 1): 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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 5659c71..30a925c 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -12941,9 +12941,9 @@ unicode_endswith(PyObject *self,
return NULL;
}
result = tailmatch(self, substring, start, end, +1);
+ Py_DECREF(substring);
if (result == -1)
return NULL;
- Py_DECREF(substring);
return PyBool_FromLong(result);
}