diff --git a/src/script_opt/TempVar.cc b/src/script_opt/TempVar.cc index e6b818c2e4..18b0f05616 100644 --- a/src/script_opt/TempVar.cc +++ b/src/script_opt/TempVar.cc @@ -10,7 +10,7 @@ TempVar::TempVar(int num, const TypePtr& t, ExprPtr _rhs) : type(t) { char buf[8192]; snprintf(buf, sizeof buf, "#%d", num); - name = util::copy_string(buf); + name = buf; id = nullptr; } diff --git a/src/script_opt/TempVar.h b/src/script_opt/TempVar.h index d79ade7902..3cfab4f6fe 100644 --- a/src/script_opt/TempVar.h +++ b/src/script_opt/TempVar.h @@ -5,18 +5,18 @@ // Class for managing temporary variables created during statement reduction // for compilation. +#include + #include "zeek/ID.h" #include "zeek/Expr.h" - namespace zeek::detail { class TempVar { public: TempVar(int num, const TypePtr& t, ExprPtr rhs); - ~TempVar() { delete name; } - const char* Name() const { return name; } + const char* Name() const { return name.data(); } const zeek::Type* Type() const { return type.get(); } const Expr* RHS() const { return rhs.get(); } @@ -26,7 +26,7 @@ public: bool IsActive() const { return active; } protected: - char* name; + std::string name; IDPtr id; const TypePtr& type; ExprPtr rhs;