diff options
| author | Mason Reed <mason@vector35.com> | 2025-06-13 02:36:35 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-06-13 02:36:35 -0400 |
| commit | 0c34857925e6b0c220871f921f5cf4d59bbdb403 (patch) | |
| tree | 961df42cc54dbb3a2ebbcbf30abbdbf3930cb027 /binaryview.cpp | |
| parent | 5700131107640018205653472891110147818179 (diff) | |
Fix misc memory leaks in C++ API
Diffstat (limited to 'binaryview.cpp')
| -rw-r--r-- | binaryview.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/binaryview.cpp b/binaryview.cpp index 242b2a01..310396c0 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -939,7 +939,10 @@ void TagType::SetName(const std::string& name) std::string TagType::GetIcon() const { - return BNTagTypeGetIcon(m_object); + char* str = BNTagTypeGetIcon(m_object); + string result = str; + BNFreeString(str); + return result; } @@ -1002,7 +1005,10 @@ Ref<TagType> Tag::GetType() const std::string Tag::GetData() const { - return BNTagGetData(m_object); + char* str = BNTagGetData(m_object); + string result = str; + BNFreeString(str); + return result; } @@ -1278,13 +1284,19 @@ uint64_t Section::GetEntrySize() const std::string Section::GetLinkedSection() const { - return BNSectionGetLinkedSection(m_object); + char* str = BNSectionGetLinkedSection(m_object); + string result = str; + BNFreeString(str); + return result; } std::string Section::GetInfoSection() const { - return BNSectionGetInfoSection(m_object); + char* str = BNSectionGetInfoSection(m_object); + string result = str; + BNFreeString(str); + return result; } |
