[pypy-svn] r68506 - pypy/trunk/pypy/module/_ssl

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Oct 15 18:08:51 CEST 2009


Author: cfbolz
Date: Thu Oct 15 18:08:50 2009
New Revision: 68506

Modified:
   pypy/trunk/pypy/module/_ssl/interp_ssl.py
Log:
issue456 resolved

applied the patch. Great work haypo, thanks a lot!


Modified: pypy/trunk/pypy/module/_ssl/interp_ssl.py
==============================================================================
--- pypy/trunk/pypy/module/_ssl/interp_ssl.py	(original)
+++ pypy/trunk/pypy/module/_ssl/interp_ssl.py	Thu Oct 15 18:08:50 2009
@@ -204,11 +204,13 @@
     def __init__(self, space):
         self.space = space
         self.w_socket = None
-        self.ctx = lltype.malloc(SSL_CTX_P.TO, 1, flavor='raw')
-        self.ssl = lltype.malloc(SSL_P.TO, 1, flavor='raw')
+        self.ctx = lltype.nullptr(SSL_CTX_P.TO)
+        self.ssl = lltype.nullptr(SSL_P.TO)
         self.server_cert = lltype.nullptr(X509_P.TO)
         self._server = lltype.malloc(rffi.CCHARP.TO, X509_NAME_MAXLEN, flavor='raw')
+        self._server[0] = '\0'
         self._issuer = lltype.malloc(rffi.CCHARP.TO, X509_NAME_MAXLEN, flavor='raw')
+        self._issuer[0] = '\0'
     
     def server(self):
         return self.space.wrap(rffi.charp2str(self._server))
@@ -225,6 +227,8 @@
             libssl_SSL_free(self.ssl)
         if self.ctx:
             libssl_SSL_CTX_free(self.ctx)
+        lltype.free(self._server, flavor='raw')
+        lltype.free(self._issuer, flavor='raw')
     
     def write(self, data):
         """write(s) -> len



More information about the Pypy-commit mailing list