From 6ed8f189b2a0607a13c2a2163d82993ca60d2a19 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Thu, 26 Jan 2023 16:37:39 -0500 Subject: Fix Type object leaks --- function.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'function.cpp') diff --git a/function.cpp b/function.cpp index 41109dea..4be60124 100644 --- a/function.cpp +++ b/function.cpp @@ -794,7 +794,7 @@ Ref Function::GetType() const Confidence> Function::GetReturnType() const { BNTypeWithConfidence tc = BNGetFunctionReturnType(m_object); - Ref type = tc.type ? new Type(BNNewTypeReference(tc.type)) : nullptr; + Ref type = tc.type ? new Type(tc.type) : nullptr; return Confidence>(type, tc.confidence); } @@ -1501,7 +1501,7 @@ Confidence> Function::GetVariableType(const Variable& var) BNTypeWithConfidence type = BNGetVariableType(m_object, &var); if (!type.type) return nullptr; - return Confidence>(new Type(BNNewTypeReference(type.type)), type.confidence); + return Confidence>(new Type(type.type), type.confidence); } @@ -1706,7 +1706,7 @@ void Function::SetUserCallRegisterStackAdjustment( Confidence> Function::GetCallTypeAdjustment(Architecture* arch, uint64_t addr) { BNTypeWithConfidence result = BNGetCallTypeAdjustment(m_object, arch->GetObject(), addr); - return Confidence>(result.type ? new Type(BNNewTypeReference(result.type)) : nullptr, result.confidence); + return Confidence>(result.type ? new Type(result.type) : nullptr, result.confidence); } @@ -1778,7 +1778,7 @@ Ref Function::GetIntegerConstantDisplayTypeEnumType( { BNType* apiType = BNGetIntegerConstantDisplayTypeEnumerationType(m_object, arch->GetObject(), instrAddr, value, operand); if (apiType) - return new Type(BNNewTypeReference(apiType)); + return new Type(apiType); return nullptr; } -- cgit v1.3.1