Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Copy the name of the "file", as we don't know where it comes from.
authordegomme <augustin.degomme@unibas.ch>
Wed, 13 Jul 2016 08:28:54 +0000 (10:28 +0200)
committerdegomme <augustin.degomme@unibas.ch>
Wed, 13 Jul 2016 08:29:02 +0000 (10:29 +0200)
If it's not generated by __FILE__ (fortran, for example), it may be destroyed too soon.
This can cause a leak, I will see to that later

src/smpi/smpi_bench.cpp

index 964e4e2..adbbd3d 100644 (file)
@@ -98,10 +98,10 @@ namespace {
 class smpi_source_location {
 public:
   smpi_source_location(const char* filename, int line)
-    : filename(filename), filename_length(strlen(filename)), line(line) {}
+    : filename(xbt_strdup(filename)), filename_length(strlen(filename)), line(line) {}
 
   /** Pointer to a static string containing the file name */
-  const char* filename = nullptr;
+  char* filename = nullptr;
   int filename_length = 0;
   int line = 0;