mirror of
https://github.com/python/cpython.git
synced 2025-09-02 15:07:53 +00:00
Fix ref leak in error case of unicode rindex and rfind
CID 983320: Resource leak (RESOURCE_LEAK) CID 983321: Resource leak (RESOURCE_LEAK) leaked_storage: Variable substring going out of scope leaks the storage it points to.
This commit is contained in:
parent
22ed7fe906
commit
ea71a525c3
1 changed files with 12 additions and 4 deletions
|
@ -12248,10 +12248,14 @@ unicode_rfind(PyObject *self, PyObject *args)
|
||||||
&start, &end))
|
&start, &end))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (PyUnicode_READY(self) == -1)
|
if (PyUnicode_READY(self) == -1) {
|
||||||
|
Py_DECREF(substring);
|
||||||
return NULL;
|
return NULL;
|
||||||
if (PyUnicode_READY(substring) == -1)
|
}
|
||||||
|
if (PyUnicode_READY(substring) == -1) {
|
||||||
|
Py_DECREF(substring);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
result = any_find_slice(-1, self, substring, start, end);
|
result = any_find_slice(-1, self, substring, start, end);
|
||||||
|
|
||||||
|
@ -12280,10 +12284,14 @@ unicode_rindex(PyObject *self, PyObject *args)
|
||||||
&start, &end))
|
&start, &end))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (PyUnicode_READY(self) == -1)
|
if (PyUnicode_READY(self) == -1) {
|
||||||
|
Py_DECREF(substring);
|
||||||
return NULL;
|
return NULL;
|
||||||
if (PyUnicode_READY(substring) == -1)
|
}
|
||||||
|
if (PyUnicode_READY(substring) == -1) {
|
||||||
|
Py_DECREF(substring);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
result = any_find_slice(-1, self, substring, start, end);
|
result = any_find_slice(-1, self, substring, start, end);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue