mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
Fix resource leak in pickle module
CID 983309 (#1 of 1): Resource leak (RESOURCE_LEAK) leaked_storage: Variable unicode_str going out of scope leaks the storage it points to.
This commit is contained in:
parent
d47802eef7
commit
82e6b94b95
1 changed files with 3 additions and 1 deletions
|
|
@ -1748,9 +1748,11 @@ save_bytes(PicklerObject *self, PyObject *obj)
|
||||||
return -1;
|
return -1;
|
||||||
if (latin1 == NULL) {
|
if (latin1 == NULL) {
|
||||||
latin1 = PyUnicode_InternFromString("latin1");
|
latin1 = PyUnicode_InternFromString("latin1");
|
||||||
if (latin1 == NULL)
|
if (latin1 == NULL) {
|
||||||
|
Py_DECREF(unicode_str);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
reduce_value = Py_BuildValue("(O(OO))",
|
reduce_value = Py_BuildValue("(O(OO))",
|
||||||
codecs_encode, unicode_str, latin1);
|
codecs_encode, unicode_str, latin1);
|
||||||
Py_DECREF(unicode_str);
|
Py_DECREF(unicode_str);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue