summaryrefslogtreecommitdiff
path: root/datarenderer.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 /datarenderer.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 'datarenderer.cpp')
-rw-r--r--datarenderer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/datarenderer.cpp b/datarenderer.cpp
index 40c64d66..a2ed1dae 100644
--- a/datarenderer.cpp
+++ b/datarenderer.cpp
@@ -17,6 +17,7 @@ DataRenderer::DataRenderer()
renderer.freeObject = FreeCallback;
renderer.isValidForData = IsValidForDataCallback;
renderer.getLinesForData = GetLinesForDataCallback;
+ renderer.freeLines = FreeLinesCallback;
AddRefForRegistration();
m_object = BNCreateDataRenderer(&renderer);
}
@@ -106,6 +107,12 @@ void DataRenderer::FreeCallback(void* ctxt)
}
+void DataRenderer::FreeLinesCallback(void* ctxt, BNDisassemblyTextLine* lines, size_t count)
+{
+ delete[] lines;
+}
+
+
bool DataRenderer::IsValidForData(BinaryView* data, uint64_t addr, Type* type, vector<pair<Type*, size_t>>& context)
{
BNTypeContext* typeCtx = new BNTypeContext[context.size()];