Commit 799e3eda authored by Eli Bendersky's avatar Eli Bendersky

Issue #16076: check for return value of PyTuple_New for args (following

Coverity report) and cleanup code.
parent b8f6dc85
...@@ -950,19 +950,22 @@ element_setstate_from_Python(ElementObject *self, PyObject *state) ...@@ -950,19 +950,22 @@ element_setstate_from_Python(ElementObject *self, PyObject *state)
PICKLED_TAIL, PICKLED_CHILDREN, 0}; PICKLED_TAIL, PICKLED_CHILDREN, 0};
PyObject *args; PyObject *args;
PyObject *tag, *attrib, *text, *tail, *children; PyObject *tag, *attrib, *text, *tail, *children;
int error; PyObject *retval;
/* More instance dict members than we know to handle? */
tag = attrib = text = tail = children = NULL; tag = attrib = text = tail = children = NULL;
args = PyTuple_New(0); args = PyTuple_New(0);
error = ! PyArg_ParseTupleAndKeywords(args, state, "|$OOOOO", kwlist, &tag, if (!args)
&attrib, &text, &tail, &children);
Py_DECREF(args);
if (error)
return NULL; return NULL;
if (PyArg_ParseTupleAndKeywords(args, state, "|$OOOOO", kwlist, &tag,
&attrib, &text, &tail, &children))
retval = element_setstate_from_attributes(self, tag, attrib, text,
tail, children);
else else
return element_setstate_from_attributes(self, tag, attrib, text, retval = NULL;
tail, children);
Py_DECREF(args);
return retval;
} }
static PyObject * static PyObject *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment