Fix logic error and DECREF reported by Coverity.

This commit is contained in:
Neal Norwitz 2006-03-08 06:36:45 +00:00
parent 025f14b72d
commit 2f5e9903a0
1 changed files with 4 additions and 4 deletions

View File

@ -106,8 +106,8 @@ set_error_attr(PyObject *err, char *name, int value)
{
PyObject *v = PyInt_FromLong(value);
if (v != NULL && PyObject_SetAttrString(err, name, v) == -1) {
Py_DECREF(v);
if (v == NULL || PyObject_SetAttrString(err, name, v) == -1) {
Py_XDECREF(v);
return 0;
}
Py_DECREF(v);
@ -137,7 +137,7 @@ set_error(xmlparseobject *self, enum XML_Error code)
&& set_error_attr(err, "lineno", lineno)) {
PyErr_SetObject(ErrorObject, err);
}
Py_DECREF(err);
Py_XDECREF(err);
return NULL;
}
@ -994,7 +994,7 @@ xmlparse_ParseFile(xmlparseobject *self, PyObject *args)
if (PyFile_Check(f)) {
fp = PyFile_AsFile(f);
}
else{
else {
fp = NULL;
readmethod = PyObject_GetAttrString(f, "read");
if (readmethod == NULL) {