diff --git a/src/RuleAction.cc b/src/RuleAction.cc index d181c00b79..55ad354d85 100644 --- a/src/RuleAction.cc +++ b/src/RuleAction.cc @@ -69,12 +69,9 @@ void RuleActionEvent::PrintDebug() { fprintf(stderr, " RuleActionEvent: |%s (%s)|\n", msg ? msg->CheckString() : "", handler->Name()); } -RuleActionMIME::RuleActionMIME(const char* arg_mime, int arg_strength) { - mime = util::copy_string(arg_mime); - strength = arg_strength; -} +RuleActionMIME::RuleActionMIME(const char* arg_mime, int arg_strength) : mime(arg_mime), strength(arg_strength) {} -void RuleActionMIME::PrintDebug() { fprintf(stderr, " RuleActionMIME: |%s|\n", mime); } +void RuleActionMIME::PrintDebug() { fprintf(stderr, " RuleActionMIME: |%s|\n", mime.c_str()); } RuleActionAnalyzer::RuleActionAnalyzer(const char* arg_analyzer) { string str(arg_analyzer); diff --git a/src/RuleAction.h b/src/RuleAction.h index dab891d6fe..3d78c5be8a 100644 --- a/src/RuleAction.h +++ b/src/RuleAction.h @@ -46,18 +46,16 @@ class RuleActionMIME : public RuleAction { public: explicit RuleActionMIME(const char* arg_mime, int arg_strength = 0); - ~RuleActionMIME() override { delete[] mime; } - void DoAction(const Rule* parent, RuleEndpointState* state, const u_char* data, int len) override {} void PrintDebug() override; - std::string GetMIME() const { return mime; } + const std::string& GetMIME() const { return mime; } int GetStrength() const { return strength; } private: - const char* mime; + std::string mime; int strength; };