Fixed memory leak in marshal.

This commit is contained in:
Serhiy Storchaka 2015-01-28 17:10:48 +02:00
parent e09bcc874a
commit 000daaee57
1 changed files with 3 additions and 1 deletions

View File

@ -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);