summaryrefslogtreecommitdiff
path: root/view/kernelcache/api/python
diff options
context:
space:
mode:
Diffstat (limited to 'view/kernelcache/api/python')
-rw-r--r--view/kernelcache/api/python/_kernelcachecore_template.py1
-rw-r--r--view/kernelcache/api/python/kernelcache.py15
2 files changed, 4 insertions, 12 deletions
diff --git a/view/kernelcache/api/python/_kernelcachecore_template.py b/view/kernelcache/api/python/_kernelcachecore_template.py
index ecbcb35d..cac7eb42 100644
--- a/view/kernelcache/api/python/_kernelcachecore_template.py
+++ b/view/kernelcache/api/python/_kernelcachecore_template.py
@@ -8,6 +8,7 @@ import platform
core = None
core_platform = platform.system()
+from binaryninja._binaryninjacore import BNFreeString, BNFreeStringList, BNAllocString
from binaryninja import Settings
if Settings().get_bool("corePlugins.view.kernelCache"):
from binaryninja._binaryninjacore import BNGetBundledPluginDirectory
diff --git a/view/kernelcache/api/python/kernelcache.py b/view/kernelcache/api/python/kernelcache.py
index 2148f2a8..9425ef9c 100644
--- a/view/kernelcache/api/python/kernelcache.py
+++ b/view/kernelcache/api/python/kernelcache.py
@@ -207,15 +207,10 @@ class KernelCache:
"""
Return a KernelCacheMachOHeader for the image with the given install name.
"""
- s = BNAllocString(name)
- outputStr = kccore.BNKCViewGetImageHeaderForName(self.handle, s)
+ outputStr = kccore.BNKCViewGetImageHeaderForName(self.handle, name)
if outputStr is None:
return None
- output = outputStr
- BNFreeString(outputStr)
- if output == "":
- return None
- return KernelCacheMachOHeader.LoadFromString(output)
+ return KernelCacheMachOHeader.LoadFromString(outputStr)
def get_macho_header_for_address(self, address: int):
"""
@@ -224,11 +219,7 @@ class KernelCache:
outputStr = kccore.BNKCViewGetImageHeaderForAddress(self.handle, address)
if outputStr is None:
return None
- output = outputStr
- BNFreeString(outputStr)
- if output == "":
- return None
- return KernelCacheMachOHeader.LoadFromString(output)
+ return KernelCacheMachOHeader.LoadFromString(outputStr)
@property
def state(self):