From 4025361513068463390900635313910200542556 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Tue, 14 Nov 2023 18:35:38 -0500 Subject: Fix a number of leaks and bad uses of free in the api See https://github.com/Vector35/binaryninja-api/issues/4751 --- binaryview.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index 077f2b4a..7abb01cb 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -769,6 +769,13 @@ std::vector> Tag::ConvertTagList(BNTag** tags, size_t count) } +void Tag::FreeTagList(BNTag** tags, size_t count) +{ + delete[] tags; + (void)count; +} + + std::vector> Tag::ConvertAndFreeTagList(BNTag** tags, size_t count) { auto result = ConvertTagList(tags, count); @@ -859,6 +866,13 @@ std::vector TagReference::ConvertTagReferenceList(BNTagReference* } +void TagReference::FreeTagReferenceList(BNTagReference* tags, size_t count) +{ + delete[] tags; + (void)count; +} + + std::vector TagReference::ConvertAndFreeTagReferenceList(BNTagReference* tags, size_t count) { auto result = ConvertTagReferenceList(tags, count); @@ -3621,6 +3635,7 @@ bool BinaryView::ParseTypeString(const string& source, map errors = errorStr; BNFreeString(errorStr); } + delete[] typesList.names; if (!ok) return false; -- cgit v1.3.1