summaryrefslogtreecommitdiff
path: root/Python/marshal.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-01-28 17:10:48 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2015-01-28 17:10:48 +0200
commit000daaee57df015ff541f267ccbe733b4413658f (patch)
tree782b0edff4a65f058259bdc1efd8b3381d3e3d36 /Python/marshal.c
parente09bcc874a21ce351a7fe73b9a137e236550d03c (diff)
downloadcpython-git-000daaee57df015ff541f267ccbe733b4413658f.tar.gz
Fixed memory leak in marshal.
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index bb5faf3297..6f0ee5e83e 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -1522,8 +1522,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);