[Python-checkins] r52247 - python/branches/release24-maint/Modules/_csv.c python/branches/release24-maint/Modules/_ssl.c

andrew.kuchling python-checkins at python.org
Mon Oct 9 20:30:14 CEST 2006


Author: andrew.kuchling
Date: Mon Oct  9 20:30:13 2006
New Revision: 52247

Modified:
   python/branches/release24-maint/Modules/_csv.c
   python/branches/release24-maint/Modules/_ssl.c
Log:
[Partial backport of r45947 | neal.norwitz]

Fix problems found by Coverity.

_ssl.c: under fail: self is DECREF'd, but it would have been NULL.

_csv.c: I'm not sure if lineterminator could have been anything other than
a string.  However, other string method calls are checked, so check this
one too.


Modified: python/branches/release24-maint/Modules/_csv.c
==============================================================================
--- python/branches/release24-maint/Modules/_csv.c	(original)
+++ python/branches/release24-maint/Modules/_csv.c	Mon Oct  9 20:30:13 2006
@@ -1051,6 +1051,8 @@
 	int terminator_len;
 
 	terminator_len = PyString_Size(self->dialect->lineterminator);
+	if (terminator_len == -1)
+		return 0;
 
 	/* grow record buffer if necessary */
 	if (!join_check_rec_size(self, self->rec_len + terminator_len))

Modified: python/branches/release24-maint/Modules/_ssl.c
==============================================================================
--- python/branches/release24-maint/Modules/_ssl.c	(original)
+++ python/branches/release24-maint/Modules/_ssl.c	Mon Oct  9 20:30:13 2006
@@ -184,9 +184,9 @@
 	int sockstate;
 
 	self = PyObject_New(PySSLObject, &PySSL_Type); /* Create new object */
-	if (self == NULL){
-		errstr = "newPySSLObject error";
-		goto fail;
+	if (self == NULL) {
+		PyErr_SetString(PySSLErrorObject, "newPySSLObject error");
+		return NULL;
 	}
 	memset(self->server, '\0', sizeof(char) * X509_NAME_MAXLEN);
 	memset(self->issuer, '\0', sizeof(char) * X509_NAME_MAXLEN);


More information about the Python-checkins mailing list