summaryrefslogtreecommitdiffstats
path: root/Modules/pyexpat.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-03-08 06:36:45 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-03-08 06:36:45 (GMT)
commit2f5e9903a0fa693670cded538dd42088cb2661cf (patch)
tree24c3de9816224d3f72a54a77e7a5d96802e798ef /Modules/pyexpat.c
parent025f14b72d9d8da16754dbe926ab9a8401ce2b19 (diff)
downloadcpython-2f5e9903a0fa693670cded538dd42088cb2661cf.zip
cpython-2f5e9903a0fa693670cded538dd42088cb2661cf.tar.gz
cpython-2f5e9903a0fa693670cded538dd42088cb2661cf.tar.bz2
Fix logic error and DECREF reported by Coverity.
Diffstat (limited to 'Modules/pyexpat.c')
-rw-r--r--Modules/pyexpat.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index b3001ea..e4bf180 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -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) {