diff options
| author | Xusheng <xusheng@vector35.com> | 2023-09-11 17:04:20 +0800 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2023-09-11 13:24:31 -0400 |
| commit | f9a9abdff9cc539f5a92c56f8942946a8ac718be (patch) | |
| tree | 05fce5a4a252c2768d448e5b8b61cb101ad7d125 /binaryview.cpp | |
| parent | b4da85f227630f8a1d7f4328f45e0f7d3d5a7e29 (diff) | |
Fix memory leak in functions calling BNCreateUserFunction
Diffstat (limited to 'binaryview.cpp')
| -rw-r--r-- | binaryview.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/binaryview.cpp b/binaryview.cpp index 6120e10f..db1974da 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -1795,9 +1795,12 @@ void BinaryView::RemoveAnalysisFunction(Function* func, bool updateRefs) } -void BinaryView::CreateUserFunction(Platform* platform, uint64_t start) +Ref<Function> BinaryView::CreateUserFunction(Platform* platform, uint64_t start) { - BNCreateUserFunction(m_object, platform->GetObject(), start); + BNFunction* func = BNCreateUserFunction(m_object, platform->GetObject(), start); + if (!func) + return nullptr; + return new Function(func); } |
