mirror of
https://github.com/python/cpython.git
synced 2025-11-26 13:22:51 +00:00
Fix memory leak in pyexpat PyUnknownEncodingHandler
CID 1040367 (#1 of 1): Resource leak (RESOURCE_LEAK) leaked_storage: Variable u going out of scope leaks the storage it points to.
This commit is contained in:
parent
305e49e17e
commit
b582155789
1 changed files with 3 additions and 1 deletions
|
|
@ -1128,8 +1128,10 @@ PyUnknownEncodingHandler(void *encodingHandlerData,
|
||||||
}
|
}
|
||||||
|
|
||||||
u = PyUnicode_Decode((char*) template_buffer, 256, name, "replace");
|
u = PyUnicode_Decode((char*) template_buffer, 256, name, "replace");
|
||||||
if (u == NULL || PyUnicode_READY(u))
|
if (u == NULL || PyUnicode_READY(u)) {
|
||||||
|
Py_DECREF(u);
|
||||||
return XML_STATUS_ERROR;
|
return XML_STATUS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (PyUnicode_GET_LENGTH(u) != 256) {
|
if (PyUnicode_GET_LENGTH(u) != 256) {
|
||||||
Py_DECREF(u);
|
Py_DECREF(u);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue