[Python-checkins] r42911 - python/branches/release24-maint/Modules/pyexpat.c

neal.norwitz python-checkins at python.org
Wed Mar 8 07:39:50 CET 2006


Author: neal.norwitz
Date: Wed Mar  8 07:39:50 2006
New Revision: 42911

Modified:
   python/branches/release24-maint/Modules/pyexpat.c
Log:
Backport fixes reported by Coverity.

Modified: python/branches/release24-maint/Modules/pyexpat.c
==============================================================================
--- python/branches/release24-maint/Modules/pyexpat.c	(original)
+++ python/branches/release24-maint/Modules/pyexpat.c	Wed Mar  8 07:39:50 2006
@@ -105,8 +105,8 @@
 {
     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);
@@ -136,7 +136,7 @@
           && set_error_attr(err, "lineno", lineno)) {
         PyErr_SetObject(ErrorObject, err);
     }
-    Py_DECREF(err);
+    Py_XDECREF(err);
     return NULL;
 }
 
@@ -993,7 +993,7 @@
     if (PyFile_Check(f)) {
         fp = PyFile_AsFile(f);
     }
-    else{
+    else {
         fp = NULL;
         readmethod = PyObject_GetAttrString(f, "read");
         if (readmethod == NULL) {


More information about the Python-checkins mailing list