mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
b7bb6f571b
commit
305e49e17e
|
@ -12941,9 +12941,9 @@ unicode_endswith(PyObject *self,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
result = tailmatch(self, substring, start, end, +1);
|
result = tailmatch(self, substring, start, end, +1);
|
||||||
|
Py_DECREF(substring);
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_DECREF(substring);
|
|
||||||
return PyBool_FromLong(result);
|
return PyBool_FromLong(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue