Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix leak
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 27 Oct 2017 07:46:38 +0000 (09:46 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 27 Oct 2017 07:46:38 +0000 (09:46 +0200)
src/instr/instr_interface.cpp
src/instr/instr_private.hpp

index 9ca67ce..7bcae37 100644 (file)
@@ -178,7 +178,8 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar
   if (not mark_value)
     THROWF (tracing_error, 1, "mark_value is nullptr");
 
-  simgrid::instr::Type* type = simgrid::instr::Type::getRootType()->byName(mark_type);
+  simgrid::instr::EventType* type =
+      static_cast<simgrid::instr::EventType*>(simgrid::instr::Type::getRootType()->byName(mark_type));
   if (not type) {
     THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
   } else {
@@ -186,7 +187,7 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar
       mark_color = "1.0 1.0 1.0" /*white*/;
 
     XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
-    static_cast<simgrid::instr::EventType*>(type)->addEntityValue(mark_value, mark_color);
+    type->addEntityValue(mark_value, mark_color);
   }
 }
 
index 60bffc6..1de5b6f 100644 (file)
@@ -69,7 +69,7 @@ public:
   std::map<std::string, Type*> children_;
 
   Type(std::string name, std::string alias, std::string color, Type* father);
-  ~Type();
+  virtual ~Type();
 
   std::string getName() { return name_; }
   const char* getCname() { return name_.c_str(); }
@@ -106,7 +106,7 @@ public:
   std::map<std::string, Value*> values_;
   ValueType(std::string name, std::string alias, Type* father) : Type(name, alias, "", father){};
   ValueType(std::string name, Type* father) : Type(name, name, "", father){};
-  ~ValueType();
+  virtual ~ValueType();
   void addEntityValue(std::string name, std::string color);
   void addEntityValue(std::string name);
   Value* getEntityValue(std::string name);