[Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.170,1.171

Jeremy Hylton jhylton@users.sourceforge.net
2001年10月09日 20:37:08 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv17099
Modified Files:
	socketmodule.c 
Log Message:
In newSSLObject(), initialize the various members of an SSLObject to NULL.
In SSL_dealloc(), free/dealloc them only if they're non-NULL.
Fixes some obvious core dumps, but not sure yet if there are more
semantics to the SSL calls that would affect the dealloc.
Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.170
retrieving revision 1.171
diff -C2 -d -r1.170 -r1.171
*** socketmodule.c	2001年10月10日 03:33:24	1.170
--- socketmodule.c	2001年10月10日 03:37:05	1.171
***************
*** 2508,2511 ****
--- 2508,2515 ----
 	memset(self->server, '0円', sizeof(char) * 256);
 	memset(self->issuer, '0円', sizeof(char) * 256);
+ 	self->server_cert = NULL;
+ 	self->ssl = NULL;
+ 	self->ctx = NULL;
+ 	self->Socket = NULL;
 
 	self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */
***************
*** 2619,2624 ****
 	if (self->server_cert)	/* Possible not to have one? */
 		X509_free (self->server_cert);
! 	SSL_free(self->ssl);
! 	SSL_CTX_free(self->ctx);
 	Py_XDECREF(self->Socket);
 	PyObject_Del(self);
--- 2623,2630 ----
 	if (self->server_cert)	/* Possible not to have one? */
 		X509_free (self->server_cert);
! 	if (self->ssl)
! 	 SSL_free(self->ssl);
! 	if (self->ctx)
! 	 SSL_CTX_free(self->ctx);
 	Py_XDECREF(self->Socket);
 	PyObject_Del(self);

AltStyle によって変換されたページ (->オリジナル) /