always treat native_object as a pointer

This commit is contained in:
Moisés Guimarães 2016-12-12 21:07:43 -03:00
parent b9934695fb
commit f3c1522608
2 changed files with 4 additions and 4 deletions

View File

@ -74,7 +74,7 @@ class SSLContext(object):
# wolfSSL_CTX_new() takes ownership of the method.
# the method is freed later inside wolfSSL_CTX_free()
# or if wolfSSL_CTX_new() failed to allocate the context object.
method.native_object = None
method.native_object = _ffi.NULL
if self.native_object == _ffi.NULL:
raise MemoryError("Unnable to allocate context object")
@ -84,7 +84,7 @@ class SSLContext(object):
def __del__(self):
if self.native_object is not None:
if getattr(self, 'native_object', _ffi.NULL) != _ffi.NULL:
_lib.wolfSSL_CTX_free(self.native_object)
@ -315,7 +315,7 @@ class SSLSocket(socket):
def _release_native_object(self):
if self.native_object != _ffi.NULL:
if getattr(self, 'native_object', _ffi.NULL) != _ffi.NULL:
_lib.wolfSSL_CTX_free(self.native_object)
self.native_object = _ffi.NULL

View File

@ -78,5 +78,5 @@ class WolfSSLMethod(object):
def __del__(self):
if self.native_object is not None:
if getattr(self, 'native_object', _ffi.NULL) != _ffi.NULL:
_native_free(self.native_object, _DYNAMIC_TYPE_METHOD)