summaryrefslogtreecommitdiff
path: root/architecture.cpp
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2023-11-14 18:35:38 -0500
committerGlenn Smith <glenn@vector35.com>2023-11-14 18:35:38 -0500
commit4025361513068463390900635313910200542556 (patch)
tree2dbfc8ef20c3eae8d849a02d833917dc24b28d28 /architecture.cpp
parent814d840c8d12dfcfb60a5bf172ea494825fd30c1 (diff)
Fix a number of leaks and bad uses of free in the api
See https://github.com/Vector35/binaryninja-api/issues/4751
Diffstat (limited to 'architecture.cpp')
-rw-r--r--architecture.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/architecture.cpp b/architecture.cpp
index 0e09230a..a1f6292e 100644
--- a/architecture.cpp
+++ b/architecture.cpp
@@ -2429,7 +2429,13 @@ vector<DisassemblyTextLine> DisassemblyTextRenderer::PostProcessInstructionTextL
size_t count = 0;
result = BNPostProcessDisassemblyTextRendererLines(
m_object, addr, len, inLines, lines.size(), &count, indentSpaces.c_str());
- BNFreeDisassemblyTextLines(inLines, lines.size());
+
+ for (size_t i = 0; i < lines.size(); i++)
+ {
+ InstructionTextToken::FreeInstructionTextTokenList(inLines[i].tokens, inLines[i].count);
+ Tag::FreeTagList(inLines[i].tags, inLines[i].tagCount);
+ }
+ delete[] inLines;
vector<DisassemblyTextLine> outLines;
for (size_t i = 0; i < count; i++)