summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2016-05-21 22:16:46 -0400
committerRusty Wagner <rusty@vector35.com>2016-05-21 22:17:02 -0400
commit97f1e422ea6a7825148ec0a1c64906695950053e (patch)
treee75cbf735d08fa13d87997c39f718e801eae036e
parente5320a7ad9a8b602823243228a2ddc904d8dc5e7 (diff)
Fix crash caused by automatic operator=
-rw-r--r--binaryninjaapi.h2
-rw-r--r--plugin.cpp11
2 files changed, 13 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 054e11f3..c0c9708c 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -1655,6 +1655,8 @@ namespace BinaryNinja
PluginCommand(const PluginCommand& cmd);
~PluginCommand();
+ PluginCommand& operator=(const PluginCommand& cmd);
+
static void Register(const std::string& name, const std::string& description,
const std::function<void(BinaryView* view)>& action);
static void Register(const std::string& name, const std::string& description,
diff --git a/plugin.cpp b/plugin.cpp
index 1ff02b38..9f51e989 100644
--- a/plugin.cpp
+++ b/plugin.cpp
@@ -53,6 +53,17 @@ PluginCommand::~PluginCommand()
}
+PluginCommand& PluginCommand::operator=(const PluginCommand& cmd)
+{
+ BNFreeString(m_command.name);
+ BNFreeString(m_command.description);
+ m_command = cmd.m_command;
+ m_command.name = BNAllocString(cmd.m_command.name);
+ m_command.description = BNAllocString(cmd.m_command.description);
+ return *this;
+}
+
+
void PluginCommand::DefaultPluginCommandActionCallback(void* ctxt, BNBinaryView* view)
{
RegisteredDefaultCommand* cmd = (RegisteredDefaultCommand*)ctxt;