From 000daaee57df015ff541f267ccbe733b4413658f Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 28 Jan 2015 17:10:48 +0200 Subject: [PATCH] Fixed memory leak in marshal. --- Python/marshal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Python/marshal.c b/Python/marshal.c index bb5faf32975..6f0ee5e83ed 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);