summaryrefslogtreecommitdiff
path: root/externallibrary.cpp
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2026-05-11 18:49:26 -0700
committerMark Rowe <mark@vector35.com>2026-05-19 10:36:46 -0700
commitfd40266f767e51e649fb48376e25f47a60d79765 (patch)
treedb351a36617200d4ad659bb3c1aa921b8d08f204 /externallibrary.cpp
parent297a98bff289ecde90d808f6538c2c5edf804af6 (diff)
Fix incorrect reference counting in C++ API
Diffstat (limited to 'externallibrary.cpp')
-rw-r--r--externallibrary.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/externallibrary.cpp b/externallibrary.cpp
index a2e0573a..f1b34f1a 100644
--- a/externallibrary.cpp
+++ b/externallibrary.cpp
@@ -44,7 +44,7 @@ Ref<ProjectFile> ExternalLibrary::GetBackingFile() const
BNProjectFile* file = BNExternalLibraryGetBackingFile(m_object);
if (!file)
return nullptr;
- return new ProjectFile(BNNewProjectFileReference(file));
+ return new ProjectFile(file);
}
@@ -81,7 +81,10 @@ std::optional<std::string> ExternalLocation::GetTargetSymbol()
{
if (BNExternalLocationHasTargetSymbol(m_object))
{
- return BNExternalLocationGetTargetSymbol(m_object);
+ char* sym = BNExternalLocationGetTargetSymbol(m_object);
+ std::string result = sym;
+ BNFreeString(sym);
+ return result;
}
return {};
}