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
|
@ -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…
Reference in New Issue