summaryrefslogtreecommitdiff
path: root/binaryview.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 /binaryview.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 'binaryview.cpp')
-rw-r--r--binaryview.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/binaryview.cpp b/binaryview.cpp
index 077f2b4a..7abb01cb 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -769,6 +769,13 @@ std::vector<Ref<Tag>> Tag::ConvertTagList(BNTag** tags, size_t count)
}
+void Tag::FreeTagList(BNTag** tags, size_t count)
+{
+ delete[] tags;
+ (void)count;
+}
+
+
std::vector<Ref<Tag>> Tag::ConvertAndFreeTagList(BNTag** tags, size_t count)
{
auto result = ConvertTagList(tags, count);
@@ -859,6 +866,13 @@ std::vector<TagReference> TagReference::ConvertTagReferenceList(BNTagReference*
}
+void TagReference::FreeTagReferenceList(BNTagReference* tags, size_t count)
+{
+ delete[] tags;
+ (void)count;
+}
+
+
std::vector<TagReference> TagReference::ConvertAndFreeTagReferenceList(BNTagReference* tags, size_t count)
{
auto result = ConvertTagReferenceList(tags, count);
@@ -3621,6 +3635,7 @@ bool BinaryView::ParseTypeString(const string& source, map<QualifiedName, Ref<Ty
errors = errorStr;
BNFreeString(errorStr);
}
+ delete[] typesList.names;
if (!ok)
return false;
@@ -3675,6 +3690,7 @@ bool BinaryView::ParseTypesFromSource(const string& source, const vector<string>
errors = errorStr;
BNFreeString(errorStr);
}
+ delete[] typesList.names;
if (!ok)
return false;