summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-06-29 19:37:34 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-06-29 19:37:34 (GMT)
commit82e6b94b9523beae3590d0c43eac15bf82a62c35 (patch)
tree9a1442d9c7ddc9609bf1da2519fbc14779f5072d /Modules
parentd47802eef79c828e8c99ca176171ff8fa9401b14 (diff)
downloadcpython-82e6b94b9523beae3590d0c43eac15bf82a62c35.zip
cpython-82e6b94b9523beae3590d0c43eac15bf82a62c35.tar.gz
cpython-82e6b94b9523beae3590d0c43eac15bf82a62c35.tar.bz2
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.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_pickle.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 443fbe2..002b378 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -1748,8 +1748,10 @@ save_bytes(PicklerObject *self, PyObject *obj)
return -1;
if (latin1 == NULL) {
latin1 = PyUnicode_InternFromString("latin1");
- if (latin1 == NULL)
+ if (latin1 == NULL) {
+ Py_DECREF(unicode_str);
return -1;
+ }
}
reduce_value = Py_BuildValue("(O(OO))",
codecs_encode, unicode_str, latin1);