summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-01-28 15:11:12 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-01-28 15:11:12 (GMT)
commitaaef05f003b11b3679e0d05ab633329fb5579e83 (patch)
tree9f86fd3c05580ad4e135efb990aa395ffd0bd081
parent66acbb28ee6b653b32c361591e7e009ddaf3543c (diff)
parent000daaee57df015ff541f267ccbe733b4413658f (diff)
downloadcpython-aaef05f003b11b3679e0d05ab633329fb5579e83.zip
cpython-aaef05f003b11b3679e0d05ab633329fb5579e83.tar.gz
cpython-aaef05f003b11b3679e0d05ab633329fb5579e83.tar.bz2
Fixed memory leak in marshal.
-rw-r--r--Python/marshal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index 3832085..5acf0de 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -1520,8 +1520,10 @@ PyMarshal_WriteObjectToString(PyObject *x, int version)
wf.depth = 0;
wf.version = version;
if (version >= 3) {
- if ((wf.refs = PyDict_New()) == NULL)
+ if ((wf.refs = PyDict_New()) == NULL) {
+ Py_DECREF(wf.str);
return NULL;
+ }
} else
wf.refs = NULL;
w_object(x, &wf);