From fe5079471419f18142a627d00340c86fa844fdf4 Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Thu, 2 Apr 2020 17:56:10 -0400 Subject: Fix some memory leaks --- binaryview.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index 5c0dd951..d1c44e97 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -409,7 +409,10 @@ BinaryView* TagType::GetView() const std::string TagType::GetName() const { - return BNTagTypeGetName(m_object); + char* str = BNTagTypeGetName(m_object); + string result = str; + BNFreeString(str); + return result; } @@ -725,13 +728,19 @@ Section::Section(BNSection* sec) std::string Section::GetName() const { - return BNSectionGetName(m_object); + char* str = BNSectionGetName(m_object); + string result = str; + BNFreeString(str); + return result; } std::string Section::GetType() const { - return BNSectionGetType(m_object); + char* str = BNSectionGetType(m_object); + string result = str; + BNFreeString(str); + return result; } -- cgit v1.3.1