summaryrefslogtreecommitdiff
path: root/python/function.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2022-02-01 11:35:10 -0500
committerPeter LaFosse <peter@vector35.com>2022-03-16 08:05:27 -0400
commit5ce116e4d1d3c30537f3635c06d7a0c619e55e43 (patch)
treedd96aa9d6b55b26dd247cd0b7e4d0bdfc6a15681 /python/function.py
parentefb5d8ba056fbae3f57a80f813a18c4a6da60f28 (diff)
Add support for structured logging
Diffstat (limited to 'python/function.py')
-rw-r--r--python/function.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/python/function.py b/python/function.py
index 2bd64f4a..b1887628 100644
--- a/python/function.py
+++ b/python/function.py
@@ -336,8 +336,9 @@ class Function:
>>> current_function = bv.functions[0]
>>> here = current_function.start
"""
- def __init__(self, view: Optional['binaryview.BinaryView'] = None, handle: Optional[core.BNFunctionHandle] = None):
+ def __init__(self, view: Optional['binaryview.BinaryView'] = None, handle:core.BNFunctionHandle=None):
self._advanced_analysis_requests = 0
+ self.handle = None
assert handle is not None, "creation of standalone 'Function' objects is not implemented"
FunctionHandle = ctypes.POINTER(core.BNFunction)
self.handle = ctypes.cast(handle, FunctionHandle)
@@ -349,7 +350,7 @@ class Function:
self._platform = None
def __del__(self):
- if core is not None:
+ if core is not None and self.handle is not None:
if self._advanced_analysis_requests > 0:
core.BNReleaseAdvancedFunctionAnalysisDataMultiple(self.handle, self._advanced_analysis_requests)
core.BNFreeFunction(self.handle)