summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2018-08-16 22:31:15 -0400
committerPeter LaFosse <peter@vector35.com>2018-08-16 22:40:38 -0400
commit4fdd54f690e538ddb4e38248144ef3d3e0f817da (patch)
tree966fa66915c2ebd4c836cc277715281d4803b36a
parent00fc6c96d415bd31ee5ecbec70a8e4de141674cd (diff)
Fix ref count bug
-rw-r--r--binaryninjaapi.h4
-rw-r--r--binaryview.cpp2
2 files changed, 5 insertions, 1 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index c89dd0b9..7b1e31ff 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -3063,6 +3063,8 @@ namespace BinaryNinja
size_t GetMediumLevelILExprIndex(size_t expr) const;
size_t GetMappedMediumLevelILInstructionIndex(size_t instr) const;
size_t GetMappedMediumLevelILExprIndex(size_t expr) const;
+
+ static bool IsConstantType(BNLowLevelILOperation type) { return type == LLIL_CONST || type == LLIL_CONST_PTR || type == LLIL_EXTERN_PTR; }
};
struct MediumLevelILLabel: public BNMediumLevelILLabel
@@ -3393,6 +3395,8 @@ namespace BinaryNinja
Confidence<Ref<Type>> GetExprType(size_t expr);
Confidence<Ref<Type>> GetExprType(const MediumLevelILInstruction& expr);
+
+ static bool IsConstantType(BNMediumLevelILOperation op) { return op == MLIL_CONST || op == MLIL_CONST_PTR || op == MLIL_EXTERN_PTR; }
};
class FunctionRecognizer
diff --git a/binaryview.cpp b/binaryview.cpp
index 993d19ab..293559cf 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -2118,7 +2118,7 @@ Ref<Section> BinaryView::GetSectionByName(const string& name)
{
BNSection* section = BNGetSectionByName(m_object, name.c_str());
if (section)
- return new Section(section);
+ return new Section(BNNewSectionReference(section));
return nullptr;
}